0Pricing
React Native Academy · Lesson

Handling Permissions Gracefully

Check permission status before requesting, show a contextual explanation to the user, and gracefully degrade the feature when permission is denied.

Why Permission Handling Matters

iOS and Android require explicit user consent before an app can access sensitive capabilities like the camera, location, microphone, or contacts. How you ask for and respond to permission decisions significantly affects user trust and app ratings. A poorly timed or unexplained permission request often results in denial, and once denied, the only recovery path is the device's Settings app.

Permission Lifecycle: The Four States

A permission can be in one of four states: undetermined (never asked yet), granted (user allowed it), denied (user said no during the last prompt), and restricted (iOS — blocked by parental controls, cannot be changed). Your app must handle each state correctly and never assume a permission is granted without checking.

import { PermissionStatus } from 'expo-location';

const { status } = await Location.getForegroundPermissionsAsync();

switch (status) {
  case PermissionStatus.UNDETERMINED:
    // Safe to call requestForegroundPermissionsAsync()
    break;
  case PermissionStatus.GRANTED:
    // Proceed with the feature
    break;
  case PermissionStatus.DENIED:
    // Show instructions to open Settings
    break;
}

All lessons in this course

  1. Camera Access with expo-camera
  2. Reading GPS Location with expo-location
  3. Scheduling Local Notifications
  4. Handling Permissions Gracefully
← Back to React Native Academy