Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload Not Working automatically #285

Open
mhemon opened this issue Dec 19, 2020 · 18 comments
Open

Upload Not Working automatically #285

mhemon opened this issue Dec 19, 2020 · 18 comments
Labels

Comments

@mhemon
Copy link

mhemon commented Dec 19, 2020

when trying to upload an image, it's opening a chooser, once choose an item (images) it's closed chooser then in the browser nothing selected. After that even can't open the chooser again. chooser only opens once per app execution. I tested on my device android 10. please let me know how to handle the upload. Thanks

log
2020-12-19 18:21:08.570 21838-21838/? E/omitykeeper.ap: Unknown bits set in runtime_flags: 0x8000
2020-12-19 18:21:11.601 21838-21924/com.somitykeeper.app E/Perf: Fail to get file list com.somitykeeper.app
2020-12-19 18:21:11.601 21838-21924/com.somitykeeper.app E/Perf: getFolderSize() : Exception_1 = java.lang.NullPointerException: Attempt to get length of null array
2020-12-19 18:21:11.602 21838-21924/com.somitykeeper.app E/Perf: Fail to get file list com.somitykeeper.app
2020-12-19 18:21:11.602 21838-21924/com.somitykeeper.app E/Perf: getFolderSize() : Exception_1 = java.lang.NullPointerException: Attempt to get length of null array
2020-12-19 18:21:13.447 21838-21838/com.somitykeeper.app E/libc: Access denied finding property "ro.serialno"

@mhemon mhemon changed the title File Upload Not Working automatically Upload Not Working automatically Dec 19, 2020
@mhemon
Copy link
Author

mhemon commented Dec 23, 2020

@ocram please, give me a solution.

@ocram ocram added the question label Dec 30, 2020
@ocram
Copy link
Contributor

ocram commented Dec 30, 2020

It seems you have either not implemented all the methods and callbacks as shown in the README (very likely), or your app does not have the (runtime) permission to access storage (less likely).

@mhemon
Copy link
Author

mhemon commented Jan 14, 2021

@ocram I have a question, I am using Webview in Bottom Navigation With Nav Controler, I think the Problem was in the onActivityResult method for not working on upload tasks properly. what to do with onActivity Result? NB: Selecting Image Successful but nothing selected in the browser.

this one not working...

@Override public void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); mWebView.onActivityResult(requestCode, resultCode, intent); // ... }

how to try this one in the bottom nav with nav controller?

@Override public void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); if (mFragment != null) { mFragment.onActivityResult(requestCode, resultCode, intent); } }

@mhemon
Copy link
Author

mhemon commented Jan 14, 2021

@ocram Here is a video output which you can understand where the problem is :- https://photos.app.goo.gl/5DhMht59pNHC6XLR8
NB:- No Error Found in the Log cat

@ilyassesalama
Copy link

I face same as your problem in the video, have you found a solution?

@mhemon
Copy link
Author

mhemon commented Jan 30, 2021 via email

@ilyassesalama
Copy link

I'm testing in an activity!

@mhemon
Copy link
Author

mhemon commented Jan 30, 2021

did you handle run time permission? there is no issue with the activity, just follow the code & add run time permission.

@ilyassesalama
Copy link

Everything related to permissions seems fine. Check this video, it explains the issue:
https://photos.app.goo.gl/5DhMht59pNHC6XLR8

@mhemon
Copy link
Author

mhemon commented Jan 30, 2021 via email

@mhemon
Copy link
Author

mhemon commented Jan 30, 2021 via email

@ilyassesalama
Copy link

What changes have you done to onActivityResult?

@mhemon
Copy link
Author

mhemon commented Jan 30, 2021

Nothing, just follow the doc in without fragment.

@ilyassesalama
Copy link

I did, but when I pick a file it doesn't select, I'm running on Android 10

@markzipps
Copy link

Did anyone sort this query? I'm not going to call it an issue because being new to android dev it's all on me. I am running fragments with bottom navigation. The MainActivity handles all fragment changes. I have the same thing as previous posts. The page loads but when choose file is selected it opens the file chooser, doesn't add the file name on select and doesn't allow the chooser to be reopened until the App restarts. I have followed the README file and think it's the onActivityResult not passing correctly. Being new I'm unsure where to add this code. Wherever I put it mFragment turns red for an error! Like I said, complete newbie. Please be kind :)

@mhemon
Copy link
Author

mhemon commented May 3, 2021

@markzipps no solution found for fragment. You can replace fragment to activity and follow the activity code in readme.

@piyush921
Copy link

piyush921 commented Jun 11, 2022

Hello,
I am facing the same issue here. When click on upload it open a file chooser and on selecting an image it closes, and nothing happens. Attaching video link below.
https://photos.app.goo.gl/FJu2qAtKPoTY6CD46
Testing on Android 12.
Runtime permissions are already given - read/write storage, microphone, camera.
I set advance Webview on activity, implemented all the methods, and followed the README file.
On debugging, I found out that onActivityResult is calling with the image path but not setting it in webview.

If anyone want to see the code
https://drive.google.com/file/d/1iLV87C1SfwjsumkXmKNehr36SoZlV6GJ/view?usp=sharing

@NaitLee
Copy link

NaitLee commented Sep 6, 2022

I had this problem too, but I’ve made it to work, so let me say something.
But I’m noob, correct me if something is wrong (especially Java terms).

An AdvancedWebView instance have member mActivity.
In AdvancedWebView code, when we choose file from webpage, protected void openFileInput is called, and in its procedure we see mActivity.get().startActivityForResult(...).
And there is truly an public void onActivityResult there, which is used to handle the chosen file(s).
However, in my case, it appeared that after initialization, mActivity is the activity of “my code”,
so that what being fired up was not AdvancedWebView.onActivityResult, but MyActivity.onActivityResult.

Hence, a “glue” is needed to make it work, though I don’t know if this is optimal:

public class MyActivity extends Activity {

    public static MyActivity mActivity = null;
    protected static AdvancedWebView mWebView;

    public void someInitCode() {
        // ...
        mWebView = new WebView(MyActivity.mActivity);
        // ...
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
        // Look Here!
        // From AdvancedWebView code, mRequestCodeFilePicker = REQUEST_CODE_FILE_PICKER = 51426
        if ( requestCode == 51426 ) {
            mWebView.onActivityResult(requestCode, resultCode, intent);
            return;
        }
        // ...
    }
}

P.S. Indeed I got this in May, but forgot to leave a message here. Sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants