How do we get Background Location Permissions in Expo SDK 42+?

Viewed 1015

I have a React-Native/Expo managed workflow app where I need to track a user's position when the app is running in the background.

I have successfully requested and received the user's foreground location, but the next page where the user has their background location permission requested I receive the following warning:

[Unhandled promise rejection: Error: One of the NSLocation*UsageDescription keys must be present in Info.plist to be able to use geolocation]

Here is a snippet of the code requesting 'background location'

async function getBackgroundLocationAsync() {
          let { status } = await Location.requestBackgroundPermissionsAsync()
            if(status !=='granted'){
              setErrorMsg('Permission to access background location was denied')
              return;
            }
          let backgroundLocation = await Location.getBackgroundPositionAsync({});
          setBackgroundLocation(backgroundLocation);
        }


   getBackgroundLocationAsync()
1 Answers
Related