Suitable usage of Location Services

Yevhenii Smirnov
Yevhenii Smirnov
Mar 17 2023
Posted in Best Practices

Adapting location to your application's needs

Suitable usage of Location Services

In this post, I would like to quickly go through different authorization types of Location Services in mobile devices and the use case for each one of them. If you are not familiar with the Location Services in mobile apps (Android and iOS), let me give you a short introduction.

Types of Authorization

We can split this into two concepts:

First, access to the user's location when your application is being used, also known as When in Use in iOS or Foreground (Coarse and Fine) in Android. Looks pretty clear at this point, except for Fine and Coarse concepts in Android. The Fine means your application has access to the precise location of the device and Coarse has access to the approximate location.

Secondly, you can access the user's location even when your application is not in use. in that case, you will get the device's location at any time. This is known as Always in iOS and Background in Android.

Use Cases

Retrieving the user's location when your application is in use would be enough for most use cases. This information will help you provide certain functionality that only is valuable for users when they are actively using your app, such as a store locator map.

Although the access to the user's location at any time might sound like all you need, this is only valuable for users, if your application has features that justify that kind of permission, such as Geofencing. If that's the case, apart from always having the user's most recent location, you can also send notifications when users enter or leave a certain geographical area.

Both platforms (iOS and Android) have very strict privacy policies for this use case. For instance, when your application is accessing the user's location (Always/Background access) continuously, even if the permission has been granted previously, at some point and usually within a few hours, the user will receive a system prompt alerting that location data is being accessed by your application. It will also give the user the option to switch it to When in use (iOS) or redirect to the device's settings, where users can change it to While in use or Deny (Android).

If the user is not expecting it, in the best case scenario, the user will switch to allow access only when the application is being used, but after receiving the such alert and not expecting that behavior, the location may be switched off completely. Best practices dictate that you onboard users properly, explaining the benefits of allowing access to their location continuously and ways for them to opt-out.

A Real-World Use Case

You are probably wondering what path you should take, if your application, most of the time, only needs When in use location access, but occasionally, continuous access to the user's location will be expected and useful both for the user and your application. For example, an app for a festival active only for a few days during the year, where there are different venues on which you would like to alert the users when they are nearby. This would be a great opportunity to apply the use of the Always authorization type.

But wait, my application only requested the When in use permission previously, how can I proceed?

Well, there are different approaches to that use case and I will go through one I used recently.

Let's break it into steps, so this looks more clear and understandable:

  • Your app is installed and during the onboarding screens, When in use permission is requested.
  • When you want to switch to Always, forward the user to the settings view of your app, where you have, for example, two toggle buttons. One of them is for the When in Use location and the other for Always.
  • For instance, to forward the user to the settings view, you can use a push notification or an in-app messaging deep linking to that view. You can make it even more efficient, and only focus on users that are nearby or those who have bought a ticket, for example.
  • After being redirected to the settings and authorizing the Always mode, you are all set up!
  • I would like to mention that, to ensure a smooth experience, it is very important to properly guide users every step of the way.
  • When the Always toggle is switched OFF, you should show adequate information and forward the user to the device's settings, where the location can be switched to When in use.


This is just one approach to this problem. You could adapt it to your application or take a completely different route altogether.

As always, we hope this post was helpful and feel free to share with us your ideas or feedback via our Support Channel.

Keep up-to-date with the latest news