ErT
ErT

Reputation: 33

Removing the background location alerts in iOS?

I'm writing a navigation app that tracks the user location.

In order to continue showing notification about the route (when phone is locked, answering the phone, etc.) - i also need to continue tracking the location while the app is in the background: (Capabilities>Background Modes>Location updates, locationManager.allowsBackgroundLocationUpdates = true)

I have been struggling with this question for a very long time and read a lot about it, but couldn't find the answer i'm looking for. i have implemented both options :

Option 1 - Request While In Use

(locationManager.requestWhenInUseAuthorization()):

Whenever the application is in the background there is the additional blue location alert bar on top of every application.

  1. Is there a way to remove this banner? or get it only for a really short period of time? again - i cannot use locationManager.stopUpdatingLocation() - since i need them in the background.

Option 2 - Request Always (locationManager.requestAlwaysAuthorization()):

After a while my users get the background location frightening prompt message. Example:

‘APP' has been using your location in the background. Do you want to continue allowing this?

  1. is there a way to remove this message? (looked at Waze as an example - same permissions but i'm pretty sure that i never got such a message)
  2. can i stop getting location updates in the background only when the app is terminated? and avoid the app being awakened (i actually don’t want these locations)? i tried to use the locationManager.stopUpdatingLocation() when terminating the app - on applicationWillTerminate(_ application: UIApplication)

Seems that both are not only bad UX that can discourage users, but also very uncommon in other location based apps.

I cannot figure out what i'm missing here.

Upvotes: 3

Views: 3530

Answers (1)

Edgar
Edgar

Reputation: 2540

Both mechanisms you mentioned are in place by the OS in order to protect users. They are not only alerting the user that an application in on the background retrieving its location, but also that something might be consuming battery when not needed anymore.

There's no way to avoid this, so you should decide which one fits best according to the needs of your application.

For instance, some apps give directions about a route, these apps tend to have the blue banner at the top (see Google Maps or even Apple Maps).

On the other hand, some other apps are interested in getting location updates at all times (e.g. fitness apps or apps that track all your movement, see Moves). In this situation the user will be alerted once about the fact that this app is continuously using its location on the background, if they accept it they won't be bothered again (iOS 8 and above).

Here's some info regarding option 2 from Apple staff:

A few days after the app obtains the "always" authorization and starts using location services in the background, the user will be asked to confirm once again that they still want this app to track their location in the background.

There is no developer action that can be taken to avoid this confirmation if the app is obtaining users' location in the background.

Source: Apple Forums

Alert

Source: About privacy and Location Services in iOS 8 and later

Upvotes: 2

Related Questions