1

I am developing an iOS app with Xamarin.iOS. I have granted permissions to use Location Services, and the Location icon is visible in the Status Bar as long as the app is running. However, my app needs to get the current location on one screen only - the rest of the time location is not needed.

Is it possible to turn off (hide) the Locations icon when app is not really using it?

Answers I found are for old iOS versions or work on jailbroken phones. It is my understanding that Apple is preventing this now. I would appreciate a confirmation if this is at all possible or not. Or if it is possible - some Xamarin / Objective-C /Swift examples would be great.

Stoyan Berov
  • 1,171
  • 12
  • 18
  • please share your code where you are getting location. – PlusInfosys Nov 30 '16 at 10:52
  • 1
    you can check this link: http://stackoverflow.com/questions/26528831/blue-banner-myapp-is-using-your-location-for-app-that-uses-location-services/27132483#27132483 it will help you – Sagar Snehi Nov 30 '16 at 11:10
  • The location icon shows when an app on the system is using location or has recently made use of location. You can't hide it. – Paulw11 Nov 30 '16 at 11:27

2 Answers2

4

U mean the airplane ICON in status bar?

This ICON will show when APP using location service, try to stop or remove your location request or mapView, your map SDK have their own interface, like:

locationManager = [[CLLocationManager alloc]init]; [locationManager stopUpdatingLocation];

and be sure other APP not using location service.

but it NOT sure the service will stop immediately, location manager just a monitor to system.

  • 1
    It's an arrow rather than an airplane, though. – jcaron Nov 30 '16 at 12:37
  • I'm marking this as the accepted answer. I ended up adding [locationManager stopUpdatingLocation] on all screens, and a [locationManager startUpdatingLocation] on just the one screen I needed. This, plus adding requestWhenInUseAuthorization to info.plist seem to have worked. Indeed, a few seconds are needed before the Location icon disappears, but this is much better than seeing it all the time. Thanks! – Stoyan Berov Nov 30 '16 at 15:39
0

You can use requestAlwaysAuthorization instead of requestWhenInUseAuthorization on CLLocationManager.

NOTE : Provide the related NSLocationAlwaysUsageDescription in the info.plist file, and then Blue Banner will not display.

Wolverine
  • 4,264
  • 1
  • 27
  • 49