Improving UX when requesting runtime permissions

In mobile apps, providing a good user experience is vital to keep users using them. One way we can improve the UX is when requesting the runtime permissions because if the user accepts/rejects them, the application must be user-friendly when handling each of these scenarios.

To convince our users to accept the permissions, we must display clear descriptive messages that explain the explicit reason why the application needs these permissions. Most applications provide additional screens/views to give more information about the requested permission to improve the user experience. In this article, I will show examples of how to handle permissions in different use cases.

Requesting a single permission

There are situations when you request a single permission and it is essential for the functionality of the application.

Let’s see the code

ViewModel

View

Requesting multiple permissions

It is very common to have a screen that lists all permissions when requesting multiple permissions, so the user can easily read/see all the permissions that the application needs.

Let’s see the code

I have a collection of permissions and any get selected I’m using Xamarin Essentials to enable it.

Model

Using PropertyChanged.Fody to handle the property changes.

ViewModel

Using Xamarin.Essentials to check/request permissions. When creating the list of permissions I’m checking if the permission is already enabled.

View

In my view, I have a simple CollectionView that displays the PermissionsList data.

Permissions in Android/iOS

Make sure to add the permissions you are using in Android (AndroidManifest.xaml) and iOS (Info.plist).

Detect if the permission has been disabled

Another situation to consider is when the user rejects the permission or after allowing it in the application, goes to the configuration and disables it. Due to these scenarios, it is very important to consider checking if the user has permission before executing any operation that requires it, as well as providing a way to enable it if it is disabled.

Let’s see the code

Detect if you should show the screen

ViewModel

Using Xamarin.Essentials: App.Information to take the user to the device settings.

View: Check code here.

Extra tips

  • In iOS, make sure to use descriptive messages in the Info.plist (The App Store can reject your application if the messages are not descriptive enough).
  • In Android < 6 the permissions are not requested in runtime, so make sure to show this custom UI only if the Android device >=6.
  • You can check more UI/UX permission inspirations here: https://dribbble.com/tags/permission

That’s all for now, you can check the full source code here.

Happy coding!

You may also like

3 Comments

  1. Very useful and nice article explained in detail. Always wait for your blogs because these are true learning source.

  2. Awesome article ! I downloaded the code and ran it, but the selected item event not firing at all on the collection view.. Did not make *any* changes to code… Downloaded and ran as is … Visual Studio 16.5.2