Reputation: 124
I'm building an app that needs to track user's locations for app functionality. I'm requesting user's location using expo Location
useEffect(() =>
{
(async ()=>{
var {granted}=await Location.
requestForegroundPermissionsAsync()
// if granted do something
})()
}, [])
The app asks for user's permission the first time, but if user selects "allow only this time" option,closes the app and reopens it, app doesn't ask the location permission again. How can I request permission again on app start if user previously user selected "only this time".
Upvotes: 0
Views: 566
Reputation: 171
check the location permission first using this code in useEffect
PermissionsAndroid.check(
PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION
);
Upvotes: 1