简体   繁体   中英

Android 12 app crashes when users grants approximate location permission

When requesting location from the user, if approximate location is selected rather than exact location, the app crashes unexpectedly.

Logcat gives the error simply "permission is null".

In my manifest I am stating

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

and in my request I am simultaneously requesting both fine and course, as specified in googles guide here

const getPermission = await PermissionsAndroid.requestMultiple([
  PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
  PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION,
]);

At this point, the app will crash, and only through logcat can I see the error

02-03 12:21:46.736 15320 15395 E AndroidRuntime: java.lang.IllegalArgumentException: permission is null

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM