Skip to content

Upload Not Working automatically #285

Open

Description

@mhemon

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"

Activity

  1. changed the title [-]File Upload Not Working automatically[/-] [+]Upload Not Working automatically[/+] on Dec 19, 2020
  2. mhemon commented on Dec 23, 2020

    @mhemon
    Author

    @ocram please, give me a solution.

  3. ocram commented on Dec 30, 2020

    @ocram
    Contributor

    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).

  4. mhemon commented on Jan 14, 2021

    @mhemon
    Author

    @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); } }

  5. mhemon commented on Jan 14, 2021

    @mhemon
    Author

    @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

  6. ilyassesalama commented on Jan 29, 2021

    @ilyassesalama

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

  7. mhemon commented on Jan 30, 2021

    @mhemon
    Author
  8. ilyassesalama commented on Jan 30, 2021

    @ilyassesalama

    I'm testing in an activity!

  9. mhemon commented on Jan 30, 2021

    @mhemon
    Author

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

  10. ilyassesalama commented on Jan 30, 2021

    @ilyassesalama

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

  11. mhemon commented on Jan 30, 2021

    @mhemon
    Author
  12. mhemon commented on Jan 30, 2021

    @mhemon
    Author
  13. ilyassesalama commented on Jan 30, 2021

    @ilyassesalama

    What changes have you done to onActivityResult?

  14. mhemon commented on Jan 30, 2021

    @mhemon
    Author

    Nothing, just follow the doc in without fragment.

  15. ilyassesalama commented on Jan 30, 2021

    @ilyassesalama

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

  16. markzipps commented on Apr 28, 2021

    @markzipps

    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 :)

  17. mhemon commented on May 3, 2021

    @mhemon
    Author

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

  18. piyush921 commented on Jun 11, 2022

    @piyush921

    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

  19. NaitLee commented on Sep 6, 2022

    @NaitLee

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions