Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between "Always" and "While Using App" in location services for iOS

Tags:

ios

I am flummoxed by the options in location services. The three options are "Always" and "Never" and "While Using the App".

Originally I thought "While Using the App" meant while using the app in the foreground.

"Always" meant while using it in foreground or background.

But this document

Some apps will ask to use your location only while the app is in use. An app is considered "in use" when you're actively using it in the foreground, or when it's in use in the background, which the status bar will indicate.

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.

Confusing. So what is the difference between "Always" and "While Using the App?"

like image 370
Bryan Schmiedeler Avatar asked Jun 17 '19 22:06

Bryan Schmiedeler


2 Answers

The main difference between Always and When-in-use is: if you're using the latter and your app is killed (either by the user or the OS), then your app will stop receiving CoreLocation service updates. Your app will only receive updates as long as it is in the foreground, and in the background (given you enable background location capability). The former permission will launch your app even if it isn't in memory.

You can read more on this developer documentation page. Here's an excerpt from Apple's developer documentation:

When-in-use authorization. Your app can use most services but cannot use services that automatically relaunch the app. Your app must always start services while running in the foreground. If you enable the background location capability for your app, a suspended app will wake in the background to handle location events. However, if your app is not running, it will not be launched.

Always authorization. Your app can use all location services, and it can start those services from either the foreground or the background. If a location-related event occurs when your app is not running, the system launches your app and delivers the event.

like image 64
Pranay Avatar answered Oct 03 '22 00:10

Pranay


When-in-use authorization:

This type of authorization is used when we need to access location only in the background and foreground mode. (Location-based suggestion application like many e-commerce apps)

This types of authorization support only Standard location service, iBeacon ranging, Heading service, Geocoding services.

Display blue bar when an application using our location.

Always authorization:

This type of authorization is used when we need to access location in the background, foreground, Kill and suspended states. (Tracking applications like Fitbit and Capchur)

This types of authorization support all types of location services such as Standard location service, iBeacon ranging, Heading service, Geocoding services, Significant-change location service, Visits service, and Region monitoring.

Display only small location service arrow in status bar when an application using our location.

like image 27
Hitesh Surani Avatar answered Oct 02 '22 23:10

Hitesh Surani