i'm building an expo app with the managed flow (so i don't have a direct access to the manifest in android) and i did read and even memorize the documentations and it said that i need to add the permission to the android.permissions in my app.config.json file which i did as follows:
"android": {
"permissions": [
"ACCESS_BACKGROUND_LOCATION",
"ACCESS_COARSE_LOCATION",
"ACCESS_FINE_LOCATION"
]
},
and it's still telling me the same thing , even though according to the doccumentations this is the only thing i need to do to include the permission. but for some reason either the android device is ignoring this or expo is not adding it in the manifest they're building in the background or for whatever reason the app acts just as if i didn't add these lines to the config file.
i tried multiple ways including removing the fine location permission (because somewhere somebody said that the new android update accepts only one location permission ; either fine location or background location) . and that of course didn't work.
building a standalone version of my app (because somebody said that Expo go doesn't allow background location on android)
i've seen multiple issues opened on both github and expo forums about this problem , most noticeably :
1- issue raised on github
2- issue raised on expo forums
expo permissions docs
android config docs on expo
try {
// at the following line it just breaks and jumps to the catch block
const { status } = await Location.requestBackgroundPermissionsAsync();
console.log(
"@@@@@@@@@@@@@@@@@@@@@@ requestBackgroundPermissionsAsync @@@@@@@@@@@@@@@@@@@@@@"
);
console.log(status);
console.log(
"@@@@@@@@@@@@@@@@@@@@@@ requestBackgroundPermissionsAsync @@@@@@@@@@@@@@@@@@@@@@"
);
if (status === "granted") // ... the rest of the code
} catch (error) {
console.log(error);
}
You need to add `ACCESS_BACKGROUND_LOCATION` to the AndroidManifest.
at node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:103:50 in promiseMethodWrapper
at node_modules/@unimodules/react-native-adapter/build/NativeModulesProxy.native.js:15:23 in moduleName.methodInfo.name
at node_modules/expo-location/build/Location.js:142:7 in requestBackgroundPermissionsAsync
at node_modules/expo-location/build/Location.js:142:22 in requestBackgroundPermissionsAsync
at screens/home/GoToLocation.tsx:156:25 in onGoToLocation
at http://192.168.8.102:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&minify=false:191029:39 in onGoToLocation
at node_modules/react-native/Libraries/Pressability/Pressability.js:691:17 in _performTransitionSideEffects
at node_modules/react-native/Libraries/Pressability/Pressability.js:628:6 in _receiveSignal
at node_modules/react-native/Libraries/Pressability/Pressability.js:524:8 in responderEventHandlers.onResponderRelease
the question is : is this like a bug in expo, and they need to fix it or is it something that i'm doing wrong? and if i'm doing something wrong. PLEASE HELP.
after batteling with it for a couple of days it turned out to be a bug in the new version of the expo go app 2.22.3 which doesn't read or register this type of permission at all . so i just downgraded to the version 2.21.5 and it worked just fine.
this was confirmed by one of expo's maintainers on the issue opened on github
anyways , it seems they're working on it but up until it's fixed just use the older version of the app if you're testing with android.