Android-AdvancedWebView
Android-AdvancedWebView copied to clipboard
Upload Not Working automatically
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"
@ocram please, give me a solution.
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).
@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); } }
@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
I face same as your problem in the video, have you found a solution?
just ignore fragment, do with activity it's working fine.
On Sat, Jan 30, 2021 at 5:52 AM ilyassesalama [email protected] wrote:
I face same as your problem in the video, have you found a solution?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/delight-im/Android-AdvancedWebView/issues/285#issuecomment-770109874, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADMRBN5BACYC3NCOWRZNTT3S4NJ33ANCNFSM4VCIJ5GA .
I'm testing in an activity!
did you handle run time permission? there is no issue with the activity, just follow the code & add run time permission.
Everything related to permissions seems fine. Check this video, it explains the issue: https://photos.app.goo.gl/5DhMht59pNHC6XLR8
In this video, i was trying to implement it in a fragment and i didn’t find any solution, what i do that is, add a new activity and pass user from fragment with intent and open Advance webview with Activity and upload task working fine in activity.
On Sat, 30 Jan 2021, 10:43 pm ilyassesalama, [email protected] wrote:
Everything related to permissions seems fine. Check this video, it explains the issue: https://photos.app.goo.gl/5DhMht59pNHC6XLR8
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/delight-im/Android-AdvancedWebView/issues/285#issuecomment-770241728, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADMRBN5YDAIZTELENLTZXP3S4RANJANCNFSM4VCIJ5GA .
It's working fine with an activity.
https://photos.app.goo.gl/1qME2HyvLr2XmbRS7
On Sat, 30 Jan 2021, 11:41 pm Mehedi Hasan Emon, [email protected] wrote:
In this video, i was trying to implement it in a fragment and i didn’t find any solution, what i do that is, add a new activity and pass user from fragment with intent and open Advance webview with Activity and upload task working fine in activity.
On Sat, 30 Jan 2021, 10:43 pm ilyassesalama, [email protected] wrote:
Everything related to permissions seems fine. Check this video, it explains the issue: https://photos.app.goo.gl/5DhMht59pNHC6XLR8
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/delight-im/Android-AdvancedWebView/issues/285#issuecomment-770241728, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADMRBN5YDAIZTELENLTZXP3S4RANJANCNFSM4VCIJ5GA .
What changes have you done to onActivityResult?
Nothing, just follow the doc in without fragment.
I did, but when I pick a file it doesn't select, I'm running on Android 10
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 :)
@markzipps no solution found for fragment. You can replace fragment to activity and follow the activity code in readme.
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
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.