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

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.

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.

If you want to get access to the user's location with CLLocationManager, the app will need to show that banner and the user will need to press "Allow". If they don't do that, your location manager won't be able to detect the user's location.
Apple's Maps is a special case because it's a first party app.

Related

bluebar stays forever even if stopupdating is called in iOS 11

I am accessing location services as 'always', i know all the changes made by apple in iOS 11. i updated my plist as required( added new key). I calling stopUpdatingLocation as soon as application goes to the background, but this blue still stays there saying your application is using location in the background. Top of that filled location icon in status bar changes to outlined location icon also. I am using Mapbox SDK as well. Is it a bug with iOS 11 or am i missing something? Just to give background information, i am fully aware how location services works. i tried almost all solutions to remove that blue bar, but it seems it is not happening.
I tried self.locationManager.allowsBackgroundLocationUpdates = false, self.locationManager = nil, self.locationManager.delegate = nil but nothing is helping.
It will be great if anyone can help me with this.
iOS 11 Beta release 5 has removed the unnecessary and intrusive Blue banner that displays for apps that used the location of the iPhone. Displaying the Blue bar for background location use is left to the app developer through a property.
#property(assign, nonatomic) BOOL showsBackgroundLocationIndicator
The users of the apps with location features are prompted to allow location permission first at the time of installing an app and then periodically prompted for apps that use location in the background continuously. The location use indicator arrow with three different shades is another mechanism for users to know if the location service is in use. Therefore an always appearing blue banner is unnecessary and Apple has recognized it.

iOS8: How to display blue bar "is Using Your Location" with "requestAlwaysAuthorization"

How does an app register for location services in the background and signification change location services, i.e. using requestAlwaysAuthorization, and get the Blue Bar to warn the user that they might want to end their activity?
According to Apple documentation using requestWhenInUseAuthorization:
The system displays a location-services indicator in the status bar when your app moves to the background with active location services.
However,
Apps cannot use any services that automatically relaunch the app, such as region monitoring or the significant location change service.
The limitation on requestWhenInUseAuthorization seems severe (cannot be relaunched if killed by the OS).
Can an app call both the Authorization methods?
Is the app supposed to forgo being relaunched by significant location change services, in order to get the Blue Bar to be seen?
Am I missing something obvious here?
(Similar question is Blue banner "Your app is using your location" is not showing after exiting my app. Other questions seem to want to get rid of the banner.)
The blue bar only show when you enable Background Location Updates and request when-in-use authorization in iOS 8.
Blue bar “is Using Your Location” appears shortly after exiting app
Sounds like location manager can't stop immediately. So the blue bar will appear until location manager stop completely. Or maybe it's just a bug .

iOS - How to get rid of "app is using your location" notification

I'm using Google Map SDK 1.8.1 on ios 8,
I set Allow Location Access While Using The App:
And then everytime I using GMSMapView and Home, this one shows up.
(When there is an UIViewController that contains GMSMapView in navigation stack)
How can I dismiss it programmatically ?
Thanks you.
edit: sorry, I didn't make my question clear enough.
What I mean is how can I stop GMSMapView from using Location Service when users press Home button, I think that will do the trick.
I tried Google Map's app, the notification view does disappear when you Home, so I think it is possible.
You can't prevent the banner from displaying while you're using the user's location, it's information for the user provided by the system, for them to make informed decisions about which apps they share their location with and when.
Even if you found a way to do this, I'd be extremely surprised if it would get through app review. There's no specific rule about it, as it's not an option in the API anyway, but the gist of the guidelines is that the user should know what you're doing with their location, and when you're tracking it:
4. Location
4.1 : Apps that do not notify and obtain user consent before collecting, transmitting, or using location data will be rejected
Edit - responding to home button press
In order to stop using location when the user presses the home button, you need to subscribe to notifications about entering the background. When you initialise your class which is using location, register for the following:
[[NSNotificationCenter defaultCenter] addObserver:self selector:#selector(appWillResignActive:) name:UIApplicationWillResignActiveNotification object:nil];
Then, in the method which is called for that notification, stop using location:
-(void)appWillResignActive:(NSNotification*)note
{
//stop using location here. I'm not familar with GMSMapView, but assuming you have a reference to the map view, the documentation suggests this:
self.mapView.myLocationEnabled = NO;
}
You may also want to register for the UIApplicationWillEnterForegroundNotification so that you can pick location services back up again when the user opens your app again from the app switcher.
No way to hide it. Even if I stop Location updates.
One thing is for sure:
You must use NSLocationAlwaysUsageDescription in info.plist
and
request requestAlwaysAuthorization from LocationManager
in order to
hide the blue bar forever (and still have the background capability because of Location updates).
PS: I've seen someone speaking about having the blue line disappear after a while but that did not happen to me. Can anyone confirm of auto hiding blue bar?

Location manager icon still displayed even when I call stopUpdatingLocation

Even though I called stopUpdatingLocation on my location manager, the location manager icon is still on the top right of my iPhone. Why hasn't it stopped?
There are several reasons why the location arrow on your phone may still be on even after calling stopUpdatingLocation.
For one, another app on your phone may currently be using your location.
Another possibility is that you enabled significant location change monitoring using the startMonitoringSignificantLocationChanges method but forgot to turn this off using the stopMonitoringSignificantLocationChanges method. Apps that are monitoring significant location changes will display a solid arrow in the status bar in the same way apps that are using standard location updates do.
Of course it's also possible that you are for whatever reason incorrectly calling stopUpdatingLocation and you actually are still getting location updates from a location manager. To check if this is happening wait several minutes after calling stopUpdatingLocation and go to Settings>Privacy>Location Services and find your app. If there is a solid purple arrow next to your app then your app is indeed currently using location services and something most likely went wrong when calling stopUpdatingLocation. However if there is a solid gray arrow, this just signifies that your app has recently used location services and it's likely that you did correctly stop getting updates. Another way to check if you correctly turned off location updates is by calling your CLLocationManager's location property and checking its timestamp property to make sure that it is not recent. If the timestamp is greater than the timestamp at which you called stopUpdatingLocation then you know something is wrong.
The icon you see at the top is not locationManager, is the location service of the device. If you deactivate in settings no longer appears.

CLLocationManager don't stop

Dear fellow developers,
I am trying hard to find a solution for my problem regarfing CLLocationManager.
I use a CLLocationManager instance in my Application. If the user selects the Home button on the device or terminates the application I want the location services to stop.
Therefor I call [self.locationManager stopUpdatingLocation]; - But this somehow doesn't work. The application enters the background and the small location arrow in the upper right corner of the status bar don't disappear. Even if I add [self.locationManager release] or self.locationManager.delegate = nil; - the location tracking don't stop :-/
It only disappears if I go to my device settings and switch off location services for the app. Whenever I switch back to location service enabled I immediately get a purple colored arrow next to the switch toggle and the icon reappears in the status bar.
My question is how can I turn off location services when the app enters the background or is terminated?
Thanks a lot in advance and have a nice day :-)
Your location is disabled. The location service icon "meaning" has changed on iOS 5. Take a look at this question: https://apple.stackexchange.com/questions/27463/why-is-the-location-services-icon-always-present
I Quote the answer:
It's a new feature in ios 5 called "region Monitoring"
The reason it's active even if the app is closed is that this feature
runs in iOS 5 core and notifies all apps that are registered when they
have entered or left a specific geo-fence.
Reminders does that when you use a location based reminder.
Although the location icon appears at all time. This actually has very
minimal impact on the battery due to apple really optimizing this
feature by using cell and wifi mostly.
Your app is working ok. The system behaviour is the one who changed.
You do it the right way. When entering background, it's ok if some delegate methods are called for some seconds. That should stop.
Where do you stop the location updates ? Are you sure it is triggered ? If yes, are your delegate method called even if the visual indicators tell something else ?
Are you sure you don't trigger a method that reactivate the location update after you have stopped it (because for example you can receive some updates even after stopped).
For instance if you started monitoring a significant location change, then you should unsubscribe from it with the corresponding pair method. If you are using region enter, then until you unsubscribe, the system will notify your delegates.

Resources