Open cbedoy opened 8 years ago
In marshmallow (API 23+) you need to request permissions explicitly and listen in for when they accept the permission before using any API that requires it. You need to take all the code from chooserType
down into onRequestPermissionsResult
once you confirm they accepted the camera permission. If you don't you'll get this crash.
More details in the Android Developer Documentation about how to make sure they accepted vs denied.
Hi everyone, I'm getting this error with Android level 23, my code is:
I've included the uses-permission at manifest but I can't run the library
Also I followed https://github.com/coomar2841/image-chooser-library/issues/114
4-11 00:43:36.136 16117-16117/? W/System.err: java.lang.SecurityException: Permission Denial: starting Intent { act=android.media.action.IMAGE_CAPTURE flg=0x3 cmp=com.motorola.camera/.Camera clip={text/uri-list U:file:///storage/emulated/0/bichooser/1460353410460.jpg} (has extras) } from ProcessRecord{be5a3d5 16117:com.secapp.secapp/u0a832} (pid=16117, uid=10832) with revoked permission android.permission.CAMERA 04-11 00:43:36.137 16117-16117/? W/System.err: at android.os.Parcel.readException(Parcel.java:1620) 04-11 00:43:36.137 16117-16117/? W/System.err: at android.os.Parcel.readException(Parcel.java:1573) 04-11 00:43:36.137 16117-16117/? W/System.err: at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:2696) 04-11 00:43:36.137 16117-16117/? W/System.err: at android.app.Instrumentation.execStartActivity(Instrumentation.java:1574) 04-11 00:43:36.137 16117-16117/? W/System.err: at android.app.Activity.startActivityForResult(Activity.java:3921) 04-11 00:43:36.137 16117-16117/? W/System.err: at android.app.Activity.startActivityForResult(Activity.java:3881) 04-11 00:43:36.137 16117-16117/? W/System.err: at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:843) 04-11 00:43:36.137 16117-16117/? W/System.err: at com.kbeanie.imagechooser.api.BChooser.startActivity(BChooser.java:157) 04-11 00:43:36.137 16117-16117/? W/System.err: at com.kbeanie.imagechooser.api.ImageChooserManager.takePicture(ImageChooserManager.java:251) 04-11 00:43:36.137 16117-16117/? W/System.err: at com.kbeanie.imagechooser.api.ImageChooserManager.choose(ImageChooserManager.java:217) 04-11 00:43:36.138 16117-16117/? W/System.err: at com.secapp.module.issues.IssueMapBusinessController.onRequestFromGallery(IssueMapBusinessController.java:165) 04-11 00:43:36.138 16117-16117/? W/System.err: at com.secapp.module.issues.IssuesDialog$4.onClick(IssuesDialog.java:119) 04-11 00:43:36.138 16117-16117/? W/System.err: at com.android.internal.app.AlertController$AlertParams$3.onItemClick(AlertController.java:1108) 04-11 00:43:36.138 16117-16117/? W/System.err: at android.widget.AdapterView.performItemClick(AdapterView.java:310) 04-11 00:43:36.138 16117-16117/? W/System.err: at android.widget.AbsListView.performItemClick(AbsListView.java:1145) 04-11 00:43:36.138 16117-16117/? W/System.err: at android.widget.AbsListView$PerformClick.run(AbsListView.java:3049) 04-11 00:43:36.138 16117-16117/? W/System.err: at android.widget.AbsListView$3.run(AbsListView.java:3886) 04-11 00:43:36.138 16117-16117/? W/System.err: at android.os.Handler.handleCallback(Handler.java:746) 04-11 00:43:36.138 16117-16117/? W/System.err: at android.os.Handler.dispatchMessage(Handler.java:95) 04-11 00:43:36.138 16117-16117/? W/System.err: at android.os.Looper.loop(Looper.java:148) 04-11 00:43:36.138 16117-16117/? W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5443) 04-11 00:43:36.138 16117-16117/? W/System.err: at java.lang.reflect.Method.invoke(Native Method) 04-11 00:43:36.138 16117-16117/? W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728) 04-11 00:43:36.138 16117-16117/? W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 04-11 00:43:36.142 16117-16123/? I/art: Debugger is no longer active