The user has disabled geolocation - a second time notifies the user

When I tried to get geolocation on the iPhone for the first time - I refused. Every time I want to get a location (before another page reload), I get no response (no errors and no success):

navigator.geolocation.getCurrentPosition( function (location) { ig_location.lat = location.coords.latitude; ig_location.lng = location.coords.longitude; alert('got it!'); }, function(PositionError) { alert('failed!' + PositionError.message); } ); 

Is there a way to notify the user every time I cannot get this location?
(I do not need to use watchPosition ...)

+2
source share
1 answer

The geolocation API is designed in such a way that it does not annoy the user with repeated requests after they are reduced. You can reset specify location alerts from the settings app, but that’s all you can do.

As soon as the user denies the permission for geolocation twice, the API will assume that he does not want this and does not ask again.

Exact wording from Core Location documentation:

If a user denies your location services to your applications, this method reports a kCLErrorDenied error. After receiving such an error, you should stop the location service.

+4
source

All Articles