React-native-permissions: App crash in Android on request permissions if permissions denied or approved

Created on 30 Jul 2018  路  4Comments  路  Source: zoontek/react-native-permissions

Describe your environment

  • React-Native version
    0.54.0
  • Platform: iOS, Android, both?
    Android: 7.0
  • Device (which one?), simulator?
    Samsung Galaxy 7 edge
  • OS version

  • react-native-permissions version
    1.1.1

  • Devtools: Xcode? Android Studio version?
  • (Android only: buildToolsVersion)

How to repeat issue and example

The app crashes if the permissions is granted or denied.
const granted = await Permissions.request('camera');
alert(granted);
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
console.log('You can use the camera');
} else {
console.log('Camera permission denied');
}

Explain what you did, what you expected to happen, and what actually happens.
Provide some code if needed.
Expect to grant or deny the permissions but the app crashes.

Solution

Do you know what needs to be done to address this issue? Ideally, provide a pull
request with a fix.

All 4 comments

I am not sure if the React-native-navigation is causing the problem. I created brand new project without react-native-navigation and it works fine.

if my activity launches twice,i can't get the permission dialog and dismiss it before finish,so the app will be crashed

Any Solution yet? I'm having the same issue as it crashes app when allow permissions for the first time.. after that it's running smooth.

I am closing this since this issue does not exists anymore with the 2.0.0 release.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

WrathChaos picture WrathChaos  路  25Comments

roaringUnicorn picture roaringUnicorn  路  17Comments

Daavidaviid picture Daavidaviid  路  18Comments

bithavoc picture bithavoc  路  22Comments

ozturkilgim picture ozturkilgim  路  31Comments