React Native Permissions

Phones guard private features behind permissions. The camera, microphone, photo library, location, contacts, and notifications all need approval from the user. The operating system shows a small dialog, and the user taps Allow or Deny. A well-built app asks at the right moment, explains the reason, and keeps working when the answer is no.

Why Permissions Exist

App wants camera
      │
      ▼
Operating system asks the user
      │
 ┌────┴─────┐
 │          │
Allow     Deny
 │          │
Camera    App shows a
opens     helpful fallback

Permissions protect privacy. Users decide which apps may see their location or photos, and they can change the decision in system settings at any time.

Common Permission Types

Feature            Permission Name
─────────────────────────────────────────
Take photos        Camera
Record audio       Microphone
Pick a photo       Photo library / media
Find nearby shops  Location (foreground)
Track a run        Location (background)
Send alerts        Notifications
Read contacts      Contacts

Permission States

  • Undetermined: the app has never asked
  • Granted: the user said yes
  • Denied: the user said no
  • Blocked: the user denied with "Don't ask again", so only system settings can change the answer

Declare Permissions in Configuration

Each platform requires a written reason in the app configuration. With Expo, place those reasons in app.json.

{
  "expo": {
    "ios": {
      "infoPlist": {
        "NSCameraUsageDescription": "Take photos for your profile picture.",
        "NSLocationWhenInUseUsageDescription": "Show stores close to you."
      }
    },
    "android": {
      "permissions": ["CAMERA", "ACCESS_FINE_LOCATION"]
    }
  }
}

App stores review these sentences. Write them in plain words that match the real feature.

Request a Permission in Code

Expo libraries bundle permission helpers. The camera example below reads the current state and asks only when needed.

import { useCameraPermissions } from 'expo-camera';

function CameraGate() {
  const [permission, requestPermission] = useCameraPermissions();

  if (!permission) {
    return <ActivityIndicator />;
  }

  if (!permission.granted) {
    return (
      <View style={{ padding: 20 }}>
        <Text>Camera access lets you scan receipts.</Text>
        <Button title="Allow Camera" onPress={requestPermission} />
      </View>
    );
  }

  return <CameraScreen />;
}

Location Permission Example

import * as Location from 'expo-location';

const getPlace = async () => {
  const { status } = await Location.requestForegroundPermissionsAsync();

  if (status !== 'granted') {
    Alert.alert('Location off', 'Enter your city manually instead.');
    return;
  }

  const position = await Location.getCurrentPositionAsync({});
  console.log(position.coords.latitude, position.coords.longitude);
};

Send Users to Settings

A blocked permission cannot open another system dialog. Offer a button that jumps to the settings page of the app.

import { Linking } from 'react-native';

<Button title="Open Settings" onPress={() => Linking.openSettings()} />

The Permission Request Pattern

1. User taps a feature button
2. App explains the benefit in one sentence
3. App triggers the system dialog
4. Granted → run the feature
5. Denied  → show a fallback option
6. Blocked → offer the Settings shortcut

Best Practices

  • Ask in context, right when the feature is needed
  • Never request every permission at startup
  • Explain the value before the system dialog appears
  • Request the smallest permission that works, such as foreground location instead of background
  • Offer a manual alternative, such as typing an address
  • Check the permission each time, since users can revoke it later

Summary

Permissions give users control over private device features. Declare reasons in configuration, read the current state before asking, and request access at the moment of need. Handle granted, denied, and blocked states with friendly fallbacks, and send users to system settings when only they can change the answer.