In my application, I want to check whether user is granted location permission "Always allow". Because I am doing kind of location sharing as like WhatsApp location live sharing.
Actually the test case is, when we change the location permission status to "while using the app" in the app settings and check the status on button click inside the app, I am getting "authorised Always" value.
func isAlwaysPermissionGranted() -> Bool{
let aStatus = CLLocationManager.authorizationStatus()
if aStatus == .authorizedAlways {
return true
}
return false
}
If we have "while using the app" permission, I can't differentiate the "While Using the app" and "Always". Both are having same enum values that is "authorizedAlways".
But in WhatsApp, If I changed the location permission to "While Using the App" and tried to share my live location, WhatsApp shows one alert to change the location permission in App Settings.
I want to do same like that.
Kindly help me to different in code level.