PermissionsAndroid request crashes #16626
Labels
Resolution: Fixed
A PR that fixes this issue has been merged.
Resolution: Locked
This issue was locked by the bot.
Is this a bug report?
Yes .
When we used PermissionsAndroid for Bluetooth permission in android we are getting crash as th
Have you read the Contributing Guidelines?
Yes
Environment
Steps to Reproduce
Android Permission in API Level (>=23) for BT using PermissionsAndroid.request API with rationale option.
Expected Behavior
Must show Alert Dialog if not granted earlier and return grant status
Actual Behavior
Not shown Alert Dialog and Throws Exception
(Write what happened. Add screenshots!)
Reproducible Demo
N/A
componentDidMount() {
this.requestBTPermission();
}
async requestBTPermission() {
try {
const granted = await PermissionsAndroid.request("android.permission.ACCESS_COARSE_LOCATION", {
'title': 'Turn On Bluetooth',
'message': 'App needs access to your bluetooth ' + 'to connected to CEC.'
});
Logs:
Caused by: java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
07-16 10:43:40.786 10457 10457 E AndroidRuntime: at com.facebook.react.modules.permissions.PermissionsModule$1.invoke(PermissionsModule.java:119)
07-16 10:43:40.786 10457 10457 E AndroidRuntime: at com.facebook.react.modules.permissions.PermissionsModule.onRequestPermissionsResult(PermissionsModule.java:207)
07-16 10:43:40.786 10457 10457 E AndroidRuntime: at com.facebook.react.ReactActivityDelegate$1.invoke(ReactActivityDelegate.java:211)
07-16 10:43:40.786 10457 10457 E AndroidRuntime: at com.facebook.react.ReactActivityDelegate.onResume(ReactActivityDelegate.java:131)
07-16 10:43:40.786 10457 10457 E AndroidRuntime: at com.facebook.react.ReactActivity.onResume(ReactActivity.java:66)
07-16 10:43:40.786 10457 10457 E AndroidRuntime: at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1270)
07-16 10:43:40.786 10457 10457 E AndroidRuntime: at android.app.Activity.performResume(Activity.java:6824)
07-16 10:43:40.786 10457 10457 E AndroidRuntime: at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3470)
07-16 10:43:40.786 10457 10457 E AndroidRuntime: ... 8 more
The text was updated successfully, but these errors were encountered: