This blog was written by Jon Kay, Program Manager, Location Team.

We have made big investments in Windows 10 to unify the Windows and Windows Phone app platform. Based on user and developer feedback, consent prompting for location has been improved and simplified from Windows Phone 8/8.1. These improvements are available now and apply to all apps running on a Windows 10 Mobile device, regardless of which OS version the app was created for.

Windows 10 provides a system-generated consent prompt when your apps first runs and a consolidated location permission settings page, both of which are detailed below. For apps existing that have custom permission prompts and/or custom ON/OFF permission settings, users will see both sets. This post gives details on the new prompt and settings and provides guidance on how to eliminate redundancy.

Whatís New

  • The removal of location consent prompts in the Store prior to app install and app update. This allows users to more easily download your app and stay up to date.

  • The addition of system-provided runtime location consent prompts when location is first requested. This prompt will happen automatically on behalf of your app and you no longer need to create your own custom prompt and handle the logic behind it.
  • A new API, Geolocator.RequestAccessAsync, that allows you to request location access (see the sample). Note: The user is only prompted once per app. After the first time they grant or deny permission, this method no longer prompts for permission. Apps should call the RequestAccessAsync method before accessing the userís location. In order to ensure the consent is shown the first time, your app must be in the foreground and RequestAccessAsync must be called from the UI thread. Until the user grants your app permission to their location, your app canít access location data. To ensure back-compatibility for existing apps that do not use the new API, the new consent prompt will be fired automatically when app first tries to acquire the current location.

  • System provided per-app location ON/OFF toggles will appear in the Settings app (Settings>Privacy>Location) to allow users to control location permission on a per-app level. These show up automatically for all apps that have the location capability, so you no longer need to create your own custom ON/OFF toggles and handle the logic behind them. Note: The store policy requiring custom ON/OFF toggles within your app we will removed for Windows 10 Mobile when updated store policies are published next week.

Building an ideal user experience

All apps on Windows 10 Mobile that use location will benefit from these new improvements, whether the app was installed prior to upgrade to Windows 10, installed after upgrading, or installed on a fresh Windows 10 Mobile device. Here are some things you can do to make your appís experience ideal for your users:

  • If you are building a Windows 10 package, remove your custom in-app location consent prompts and ON/OFF toggles and the logic behind them. Without doing so, users will experience double prompting (one prompt from the system and one prompt from your app) as well as have two ways to turn location ON/OFF that do not stay in sync with each other. Note that the system-provided controls will override your in-app control in the case the user turns the system provided toggle to OFF.
    • If your app is a Windows Phone 8 or Windows Phone 8.1 app, it is still required by policy to have a custom in-app location consent toggles (because the system settings on these operating systems do not include per-app toggles). To be compliant with policy as well as optimize for user experience, you may need to fork your package to have a new Windows 10 version. For guidance on managing multiple app packages, see here.

  • Be aware of when you first request location, the system-provided runtime prompt will appear. Depending on your appís functionality, you may want to wait for a user to complete an action (e.g. logging in) before asking for location to avoid a prompt appearing while the user is mid-task.
  • Optional Ė monitor changes to permissions (see StatusChanged) and if desired, pop a message or prompt to your user and redirect them directly to the Location privacy settings to reconfigure the toggles using the URI: ms-settingsrivacy-location.

The less-than-ideal user experience

For existing apps that have a custom location consent prompt, the user will see two similar prompts (one after the other) asking them the same thing, as seen below. Best practice is to remove the custom prompt.

For existing apps that have a location permission toggle in the app settings page, the user will have two places to change the settings (which can get out of sync). Best practice is to remove the in-app setting and defer to the new system settings page (Settings>Privacy>Location).

Summary and Additional Resources

This new location consent prompt approach is a large improvement because it enables a better user experience, removes a blocker to app install/update, and reduces the code needed for the enforcement of location permissions. We hope you enjoy it and welcome any feedback you may have.

Source: Location consent prompts and settings improvements in Windows 10 Mobile | Building Apps for Windows