Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Blue banner '%MyApp% is Using Your Location' for app that uses location services only when active

In my app I'm updating user location every time when app becomes active. I stop CLLocationManager once updated location is received or in applicationWillResignActive:. In Info.plist there is a NSLocationWhenInUseUsageDescription with appropriate description.

If app is activated and then immediately moved to background, blue banner saying that '%MyApp% is Using Your Location' appears for less then a second. This banner gets hidden as soon applicationWillResignActive: is called.

I've noticed the same problem in Google Maps, but not in Apple Maps.

Is there a way to get rid of this banner completely? Is there anything else I should do to make iOS happy? I do not want it to freak out my users and prevent them from using cool features that require location.

like image 687
kjam Avatar asked Oct 23 '14 13:10

kjam


Video Answer


1 Answers

You have probably set location as Background mode in your info.plist. If you remove that, then the blue bar won't appear anymore.

Or, you can use requestAlwaysAuthorization instead of requestWhenInUseAuthorization on CLLocationManager (and provide the related NSLocationAlwaysUsageDescription in the info.plist file), and then it will not appear either.

In my case, my app is using location in the background in some cases, and I would like the blue bar to appear when that is the case. But I do not want it to appear when exiting the app without location in background. As far as I know that is not possible to achieve (I've asked about it here).

EDIT: Note that starting with iOS-9, you can make sure that the blue bar only appears when the user actually wants the app to use the location in the background. See this answer.

like image 117
fishinear Avatar answered Nov 15 '22 19:11

fishinear