You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2021/05/05 13:45:02 UTC

[GitHub] [cordova-plugin-camera] breautek commented on issue #660: Cordova-plugin-camera crashes app on android devices

breautek commented on issue #660:
URL: https://github.com/apache/cordova-plugin-camera/issues/660#issuecomment-832699505


   > @PieterVanPoyer sorry for the late reply, this is what I got from the log
   > 
   > ```
   > java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=34, result=-1, data=null} to activity {de.myapp/de.myapp.MainActivity}: android.app.RecoverableSecurityException: de.myapp has no access to content://media/external/images/media/97
   >         at android.app.ActivityThread.deliverResults(ActivityThread.java:4877)
   >         at android.app.ActivityThread.handleSendResult(ActivityThread.java:4918)
   >         at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
   >         at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
   >         at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
   >         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2045)
   >         at android.os.Handler.dispatchMessage(Handler.java:107)
   >         at android.os.Looper.loop(Looper.java:214)
   >         at android.app.ActivityThread.main(ActivityThread.java:7399)
   >         at java.lang.reflect.Method.invoke(Native Method)
   >         at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:502)
   >         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:980)
   > Caused by: android.app.RecoverableSecurityException: de.myapp has no access to content://media/external/images/media/97
   > ```
   > 
   > Btw I tested it with the front camera and it logged the same error.
   > 
   > Cordova-plugin-camera : v.5.0.1
   > cordova-android : 9.1.0
   > tested on Android 10 Devices
   
   This plugin likely doesn't handle API 29/30 changes to external storage. There should be potential two workarounds for the time being:
   
   1. Target API 29 and add `requestLegacyExternalStorage` flag to the `AndroidManifest.xml` file
   
   Adding this to your `config.xml` should work:
   
   ```xml
   <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
       <application android:requestLegacyExternalStorage="true" />
   </edit-config>
   ```
   
   **Note**: `requestLegacyExternalStorage` is ignored on API 30.
   
   2. Fork this plugin and apply the PR https://github.com/apache/cordova-plugin-camera/pull/684
   This solution should work for both API 29 and API 30.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org