Search code examples
iosswiftcore-locationprivacy

Location Services: 'Blue Bar' during 'Always' Mode


As far as I looked/searched and implemented so far. The blue far should not appear when user has granted 'Always' use location services. But one of my client is getting blue bar on his iOS 12 phone. It also happened to him with google maps application, but i could not replicate it on my device.

Blue bar message says: "Google maps is actively using your location"

Is it possible, is there any other reason that is causing blue bar to appear?


POP UP ALERT:

Based on given answer's by Mr Tawk and Roee, it leads me to wonder the if the blue bar will be shown by setting showsBackgroundLocationIndicator to true, then will the popup alert will also be shown to the user? Saying: "ABC app is accessing your location in the background." Like below, as mentioned here : About privacy and Location Services in iOS 8 and later

background location use alert


Solution

  • I would make sure that the user really gave the app 'Always authorization', and that you didn't set the flag showsBackgroundLocationIndicator.

    See Apple documentation regarding this:

    Starting with iOS 11, apps have more control over the appearance of the Location Services Status Bar (Blue Bar) for their apps.

    Apps which are given When-in-use authorization by the users (regardless of the authorization asked for), will automatically get the Blue Bar displayed. Apps cannot opt out of the Blue Bar if they are only given When-in-use authorization by the users.

    Apps which are given Always authorization, on the other hand, will get the Blue Bar displayed based on a new property of the CLLocationManager object.

    @property(assign, nonatomic) BOOL showsBackgroundLocationIndicator;

    Apps which have their Continuous Background Location session active, and have obtained Always authorization the Blue Bar will be shown only when the showsBackgroundLocationIndicator property is YES.

    An app can toggle the showsBackgroundLocationIndicator property to change the visibility of the blue bar at any time.

    At those links:

    1. https://developer.apple.com/library/archive/qa/qa1965/_index.html
    2. https://developer.apple.com/documentation/corelocation/cllocationmanager/2923541-showsbackgroundlocationindicator

    EDIT: Regarding the new question - POP UP ALERT:

    Your app should ask the user permission to use the location services request permission

    For always/while using the app. If the user agreed to always allow, the iOS might remind him that the app is able to use his location.

    see this part

    Other apps will ask for access to your location even when the app isn't in use. When you allow an app to always use your location, iOS will remind you which apps are able to use your location after an app uses your location in the background.

    at https://support.apple.com/en-il/HT203033

    This usually happens once, see Apple's answer to a question at their forums:

    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.

    And this thread Removing the background location alerts in iOS?