Member-only story

React Native: Managing App Permissions for iOS

A comprehensive guide to managing permissions in React Native

--

This article covers permission management in React Native, an important consideration to ensure a seamless experience for the end user. What React Native apps need to do is listen to permission changes as they are made outside the app, and update the UX accordingly when the app is summoned back into the foreground. This is due to the fact that permissions are changed from within the Settings app, and not in the app itself.

What apps can do is request a permission via a one-time dialogue prompt, that the user can either accept or decline. It is after this initial decision that the user must jump into Settings to adjust these permissions. Therefore, what React Native must be able to do is:

  • Request permissions on a per-permission basis. We’ll cover how to enable these permissions within Xcode, and use packages like react-native-permissions to read current permission status and request permissions to be granted.
  • Check permissions when a user jumps back into the app on key screens that require those permissions to be granted, such as the camera permission for taking photos and videos in-app, or real-time location permission for apps like ride hailing apps. These checks can be done with event listeners, the implementation of which we will cover further down. If the permission has indeed been toggled, the UX can then update accordingly.

Because iOS handles permission management in the external Settings app, it is useful to understand how App State works in the context of managing permissions, and the differences between an app being in the foreground vs background. We’ll touch on this further down.

It is also worth noting that notification permissions are slightly more verbose than most others, giving the user more granularity to what can be allowed.

Before diving into integration, let’s cover how permissions are enabled in-app, and toggled thereafter.

Permission Workflows

There are two major workflows to be familiar with in order to implement permission management effectively.

--

--

Ross Bulat
Ross Bulat

Written by Ross Bulat

Programmer and Author. @ Parity Technologies, JKRB Investments

Responses (4)

Write a response