Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

Expo Location Error: Not authorized to use background location services

$
0
0

I'm creating a app that needs the current location of the user and need to run in real time. i'm using the Location.startLocationUpdatesAsync() from expo but i'm getting the error below.The app.json is already configured and in the phone i accept the location permission. someone can tell me why i'm getting the error?

app.json

"ios": {"supportsTablet": true,"bundleIdentifier": "com.ourtor.ourtorapp","buildNumber": "0.0.8","infoPlist": { "UIBackgroundModes": [ "location", "fetch" ] }    },"android": {"adaptiveIcon": {"foregroundImage": "./assets/adaptive-icon.png","backgroundColor": "#FFFFFF"      },"permissions": ["ACCESS_COARSE_LOCATION","ACCESS_FINE_LOCATION","ACCESS_BACKGROUND_LOCATION"      ]    },

map.ts

  useEffect( () => {    Location.requestPermissionsAsync().then( async (res) => {      if(res.status === "granted") {        console.log('granted')        await Location.startLocationUpdatesAsync('get-location', {          accuracy: Location.Accuracy.Balanced        })      }    });  }, [])

console android

granted[Unhandled promise rejection: Error: Not authorized to use background location services.]

console ios

grantedBackground Location has not been configured. To enable it, add 'location' to 'UIBackgroundModes' in Info.plist file.

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>