没有出现权限的对话框。使用PermissionsAndroid React-Native

时间:2018-06-12 10:09:04

标签: react-native android-permissions

const granted = await PermissionsAndroid.request(
    PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
    {
      title: 'Cool Photo App Camera Permission',
      message: 'Cool Photo App needs access to your camera ' +
        'so you can take awesome pictures.'
    }
  )
  if (granted === PermissionsAndroid.RESULTS.GRANTED || granted === true) {
   console.log("succeed")        
  } else {
    console.log("location denied");
  }
}
requestLocationPermission();

每当我运行代码时,它总是在控制台上显示“location denied”。我正在使用react-native版本0.55。

0 个答案:

没有答案