I have developed an app that allows me to track my users location when using they are in the app, but when I navigate outside of the app, my server loses its ability to track me, and I get disconnected. I have been told to use location.GetBackgroundPermissionAsync() but I cannot seem to write it right.
Below is the code I have written to track their current location. How would I rewrite it to track background location as well?
async function getLocationAsync() {
const { status, permissions } = await Permissions.askAsync(Permissions.LOCATION)
if (status === 'granted'){
return Location.getCurrentPositionAsync({ enableHighAccuracy: true });
console.log('Your location is granted')
} else {
alert('Location Permission Not Given')
}
}
getLocationAsync()