mgks / Android-SmartWebView

A simple use webview integrated w/ native features to help create most advanced hybrid applications.
https://mgks.dev/smart-webview
MIT License
570 stars 278 forks source link

Camera does not open on Huawei device with Android 10 #189

Open amanzan opened 4 years ago

amanzan commented 4 years ago

Trying to upload a file and I see the intent chooser. Tap on the camera, but it does not open. I always get Activity.RESULT_CANCELLED in onActivityResult.

Using a Huawei Mate 20 with Android 10 installed.

PS: Had to modify the switch inside onShowFileChooser, because I was getting an empty String acceptType and camera wasn't even showing in the intent chooser

amanzan commented 4 years ago

Info on how to fix this issue: https://stackoverflow.com/questions/48117511/exposed-beyond-app-through-clipdata-item-geturi

mgks commented 4 years ago

this is a long going issue of webview since the beginning. If I fix this, some other device will stop supporting.

amanzan commented 4 years ago

@mgks in the stackoverflow link I posted, you can find the solution. Also in this one: https://stackoverflow.com/questions/38200282/android-os-fileuriexposedexception-file-storage-emulated-0-test-txt-exposed You need to use fileprovider. Only Huawei device needed this. I added it and it works, and it still works on a Xiaomi device. Can't guarantee it works on all brands, but it should