iOS Tutorial Location Services Blue Bar

Discussion in 'iOS Tutorials' started by Sandman, Jul 12, 2018.

  1. Sandman

    Sandman Active Member Licensed User

    If you've used Location services on iOS you might have noticed that there's a blue bar showing when the app is in the background and using the GPS:

    upload_2018-7-12_22-1-41.png


    I noticed my app doesn't show this anymore, so I started wondering if something had broken. Couldn't really find anything in the forum, so I decided to explore the World Wide Web and found this page explaining it:

    iOS 11 Location Services Blue Bar
    https://forums.developer.apple.com/thread/84125

    This is the explanation, copied from the page:

    Starting with Beta 5, in iOS 11, the Blue Bar will appear when an Always authorized app opts-in to displaying the blue bar while it is actively receiving Continuous Background Location updates via startUpdatingLocation()

    There’s a new property on CLLocationManager that Always authorized apps can use to control the visibility of their blue bar.
    @property(assign, nonatomic) BOOL showsBackgroundLocationIndicator

    When-in-use authorized apps will continue showing the Blue Bar as before.

    No other service will turn on the Blue Bar. When an app which makes use of any other location service receives an occasional update (for example Significant Location Change), the location arrow on the status bar will momentarily blink solid, but the Blue Bar will not appear.


    So, as far as I can tell this means that the bar won't really appear automatically anymore. That's up to the app to decide, whether to show it or not, at least if you have the Always authorization. This also seems to make When-in-use authorization less interesting, as that always produce the blue bar.

    I thought some other forum members might find this interesting.
     
    JordiCP and lemonisdead like this.
  2. Erel

    Erel Administrator Staff Member Licensed User

    I don't think so. As a user I almost never allow apps to always get the location data. Only when in-use.
     
  3. Sandman

    Sandman Active Member Licensed User

    I take it that you mean that you never see the blue bar? Could it be that the apps you're thinking of aren't doing it in the background?

    Just to check, I started my app (which does the whole location-in-background thing) and went into the app settings in the system Settings App. I found my app there, found what my app is allowed to access. In that list is Location, which said Always. No blue bar visible. I tried changing it to While Using the App, and to my surprise the blue bar is instantly visible. Changed it back to Always, and blue bar is instantly gone.

    Tested on iPhone 8+ running 11.4.1.
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    I think that we misunderstood each other. As a user I prefer to limit apps to only use the location service while the app is in the foreground. So I don't agree with this statement:
    You should only use the "always" permission if you need your app to track location in the background.
     
  5. Sandman

    Sandman Active Member Licensed User

    Yeah, we probably did. And to clarify my statement, this is what I should have written:

    This also seems to make When-in-use authorization less interesting when one track location in the background, as that always produce the blue bar.​


    Let's assume an example app tracks location in background, would you agree to this list?

    App in foreground + While Using the App --> no blue bar
    App in foreground + Always --> no blue bar

    App in background + While Using the App --> blue bar
    App in background + Always --> no blue bar
    App in background + Always + manually enabling the blue bar --> blue bar

    If not, what do you think is wrong?
     
    Erel likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice