I am developing an app that subscribes to user's significant location changes, visit changes and region (geofence) changes. However, I always see a solid location icon in the status bar. Looking at "Privacy->Location Services" settings I see that recently the location was used by my app and some other app.
Also once I set location permission for my app to 'Never', the location icon in status bar disappears.
I am wondering whether the subscription to significant location changes, visits and region changes cause iOS to show the Solid Location icon.
I am actually sitting in my room for half of the day and as a result the phone doesn't change location and I do not expect any location change event to be fired.
What is the exact condition when solid location icon is shown in the status bar?
I've read this question, but I think it is unrelated.
I wanted to cover all aspects of your question and I hope you don't mind a long descriptive answer.
Permission levels:
Never - User denies the app permission to use the location.
While In Use - User has given the app permission to use use the location when it is in use. This means foreground and location access is granted to the app while the user is actively using it.
Always - User has given the app permission to use the location in background and foreground.
The main arrow denotes location use:
The arrow at the right top corner before the battery level indicator can have two shades.
Hollow (outlined) - Indicates that there are apps on the phone that use geofencing
Solid arrow - Indicates that there are one or more apps that actively use the location of the phone including GPS. The solid arrow displays for apps running in the foreground and background.
If your app is utilizing region monitoring then, it gets delegate callbacks for entry and exit events. This often means the phone is being tracked using significant location changes. For region monitoring, you don't need to explicitly register to receive location updates as it is all taken care of by the underlying APIs.
The solid arrow will continuously display in case you have regions that are in close proximity to the phone, my observation is anywhere up to 3KM. The distance is unpredictable and largely depends on the geographic location of the phone, but I have noticed the continuous use of location to trigger regions and then the OS switches back to significant change based monitoring once the region has triggered or the phone has moved a lot further. If this is not the case, then review the LocationManager delegate implementation to make sure the app is not receiving updates more frequently.
On the other hand, if you are registering for significant changes in location to be notified, then the solid arrow will display whenever location updates are delivered to the app.
The solid purple, solid gray and outlined purple arrows in privacy settings are displayed against the apps and are described in the screenshot below.
Related
I have a navigation app (iOS 9.3) that can also run in the background (voice guidance and coordinate and speed logging)
So far this only works when users accept the 'always' Location Access. When users change location access to 'While Using' the blue bar appears when back grounded (which is what I want, or at least don't mind) but Location updates stop after about 5 minutes of being backgrounded.
I noticed that Google Maps can do this even when location access is set to 'whileInUse' (blue bar 'Google Maps is using your location' appears when backgrounded) and was wondering exactly how they do it.
Could find some similar questions here on SO, but none that really could answer this.
I'm guessing that it has something to do with enabling 'Background App Refresh' for my app, but not sure... and if that's the solution how exactly would I go about that?
I've implemented a CLLocation like waze to get the users location on background mode, I want to show the bar like "incall" showing that I'm getting the location.
I don't know why the bar doesn't show, I have in the info.plist this
Key : NSLocationAlwaysUsageDescription.
I assume you are talking about the blue "navigation" bar that appears under the status bar.
That only appears when an app is being used for navigation. An app that simply gets location in the background does not show the blue bar (or any other color bar).
If you requestAlwaysAuthorization the bar will not appear (because you could use location services at any time). The bar appears only when you requestWhenInUseAuthorization and the app asks to keep receiving location updates while in the background.
See the documentation for requestWhenInUseAuthorization (emphasis added):
If the user grants “when-in-use” authorization to your app, your app
can start most (but not all) location services while it is in the
foreground. (Apps cannot use any services that automatically relaunch
the app, such as region monitoring or the significant location change
service.) When started in the foreground, services continue to run in
the background if your app has enabled background location updates in
the Capabilities tab of your Xcode project. Attempts to start location
services while your app is running in the background will fail. The
system displays a location-services indicator in the status bar when
your app moves to the background with active location services.
This line about the "location-services indicator" is notably absent from the documentation for requestAlwaysAuthorization.
There are two approaches for showing an app/app suggestion (incase not installed) on the iphone lock screen / app switcher. One is GPS based, in which the IOS decides which app to show as a suggestion. Another is beacon based, in which a particular beacon is identified.
If location services are enabled for multiple apps and say all these apps are also using beacon based approach to show their icons on the lock screen left corner, which app icon will be shown by the IOS?
Since location services are enabled for these apps,and say there is another relevant app which is NOT using beacon based approach (using just the GPS based approach), can IOS give preference to beacon based apps over the GPS based this new app.?
For instance, Estimote’s NYC office is on the same block as an Equinox gym and our phones intelligently and automatically alert us to use that app. It’s super easy and intuitive to open the app while walking into the gym - and in the process, streamline the check-in flow with the gym’s front desk. However, because it solely uses GPS geofences, the accuracy is poor. We actually get the Equinox icon over 1 block away, and there is no control for the brands or stores (in this case Equinox) on how this appears.
Apple's suggestion of apps not installed on the phone based on proximity uses an undocumented technique. While I have verified it uses GPS as an input, I have never been able to confirm that beacons are used at all.
Regardless of whether beacons are used, because this is an undocumented feature, it is unlikely you will find a way to customize the behavior.
AFAIK, Apple has never shared the implementation details of how the lock screen icon AKA "suggested apps" feature works.
However, we did some experiments at Estimote and noticed that being inside a CLRegion (both the "GPS" CLCircularRegion, and CLBeaconRegion work) that an app monitors for via Core Location, consistently makes the app's icon show up on the lock screen. So it seems that both beacons and GPS location fall into the same mechanism that governs the location-based suggestions. (Note that in iOS 9, that's not just the lock screen icon, but also a bar at the bottom of the app switcher.)
Unfortunately, we weren't able to establish what happens if you're inside multiple qualifying CLRegions, belonging to different apps. We suspect it might have something to do with the order in which the apps register regions for monitoring, but were never able to get consistent results.
Furthermore, since this whole behavior is undocumented, Apple can change it at any time. Just something to be aware of.
Side note: handoff always trumps suggested apps.
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 .
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.