Open digitalprecision opened 7 years ago
Not yet, I'm afraid.
But https://github.com/delight-im/Android-AdvancedWebView/issues/10 might be more helpful if you need some examples. There are some links that should help.
There is an easy fix for this. Can you add a public callback so we can override the default behavior in AdvancedWebView onShowFileChooser
method? For now I just created my own version of AdvancedWebView so I could add my activity method for handling images. But with a callback, all would be able to benefit.
HI digitalprecision,
i have the same problem and looking for camera solution, if you dont mind can copy paste here or send your solution to amit204nit@gmail.com. i will be very grateful.
Hi @akuma34, check out this gist: https://gist.github.com/digitalprecision/735820df14f696fc2c6c8b251b2b05d6
It uses the PermissionHelper API developed by k0sh, and the standard webview API, but I was able to easily get it to work with AdvancedWebView, however I opted to use FinestWebView b/c it has more controls over the toolbar etc.
Can you add a public callback so we can override the default behavior in AdvancedWebView onShowFileChooser method?
That may be possible. But if you supply a custom callback, the internal operations on file uploads won't work anymore, since the ValueCallback<Uri[]>
cannot be invoked multiple times. What should we do here? Such a custom callback may confuse developers as it would break other built-in features of this library.
For now I just created my own version of AdvancedWebView so I could add my activity method for handling images.
That's the correct approach (for now), you're right. But again, you're right in that this shouldn't be necessary.
But with a callback, all would be able to benefit.
I don't see any better solution right now, either.
The only solution more convenient than overriding that callback is probably extending our built-in callback (that handles file uploads correctly already) to provide support for camera access out-of-the-box, right?
Looking at your Gist, that'd be my preferred solution. Couldn't we build and start the Intent
instances for the camera access, etc. in this library and provide callbacks for the process of writing the files afterwards?
Actually I found FinestWebView to be buggy and not load our page as desired, however AdvancedWebView does. Quick question, do you have the ability for us to add a circular progress indicator, or should I create on my own?
@digitalprecision Thanks for splitting that question off into https://github.com/delight-im/Android-AdvancedWebView/issues/87 It's an important question and a recurring problem, so I created https://github.com/delight-im/Android-AdvancedWebView/issues/88 as well.
I'm still convinced that we need a much more convenient solution for camera access. We should decide on some callbacks to implement and re-use some of the code in your Gist.
I defer to your best judgement as I am a novice android developer (do more php/mysql/systems stuff) so my guidance may not be the best in this context. Feel free to use whatever you can from the gist. Glad to contribute :)
@digitalprecision, you've saved me a week (or even more) of time of the research as I am doing baby steps in Android development!
@mmalisz Glad to help. Hoping the author patches in the functionality at some point.
Just a pro-tip for anyone using this workaround: starting from SDK 24 files must be read using FileProvider instread of Uri.
For what it's worth, I ended up using parts of https://github.com/mgks/Os-FileUp to get it working.
Please add camera support
I implemented a possible solution via #20, but it didn't work. It pulls up a lot of options like gallery, google drive, images, videos, downloads etc., but no camera option.
Any working code samples available?