Expo Permissions is a deprecated centralized permissions API for React Native and Expo applications. It provides a unified interface to request and check various device permissions including camera, media library, location, notifications, contacts, calendar, audio recording, and motion sensors across iOS, Android, and web platforms.
⚠️ Deprecation Notice: This package has been deprecated in favor of requesting permissions directly from individual Expo modules (like expo-camera, expo-location) that use these permissions.
npm install expo-permissionsexpo as peer dependencyimport { getAsync, askAsync, usePermissions, CAMERA, MEDIA_LIBRARY, LOCATION_FOREGROUND } from "expo-permissions";For CommonJS:
const { getAsync, askAsync, usePermissions, CAMERA, MEDIA_LIBRARY, LOCATION_FOREGROUND } = require("expo-permissions");import { getAsync, askAsync, CAMERA, MEDIA_LIBRARY } from "expo-permissions";
// Check permission status
const cameraPermission = await getAsync(CAMERA);
console.log(cameraPermission.granted); // boolean
// Request permissions from user
const permissions = await askAsync(CAMERA, MEDIA_LIBRARY);
if (permissions.granted) {
// All requested permissions granted
console.log("All permissions granted");
} else {
// Some permissions denied or undetermined
console.log("Permissions status:", permissions.status);
}Expo Permissions is built around several key components:
getAsync, askAsync) for checking and requesting permissionsusePermissions hook for declarative permission management in React componentsCore functions for checking and requesting device permissions with unified cross-platform API and deprecation warnings.
function getAsync(...types: PermissionType[]): Promise<PermissionResponse>;
function askAsync(...types: PermissionType[]): Promise<PermissionResponse>;React hook for declarative permission management with automatic status fetching and lifecycle handling.
function usePermissions(
type: PermissionType | PermissionType[],
options?: PermissionsOptions
): [PermissionResponse | undefined, () => Promise<void>, () => Promise<void>];
interface PermissionsOptions {
ask?: boolean;
get?: boolean;
}type PermissionType =
| 'camera'
| 'mediaLibrary'
| 'mediaLibraryWriteOnly'
| 'audioRecording'
| 'locationForeground'
| 'locationBackground'
| 'userFacingNotifications'
| 'notifications'
| 'contacts'
| 'calendar'
| 'reminders'
| 'motion'
| 'systemBrightness'
| 'location' // deprecated
| 'cameraRoll'; // deprecated// Active constants
const CAMERA = "camera";
const MEDIA_LIBRARY = "mediaLibrary";
const MEDIA_LIBRARY_WRITE_ONLY = "mediaLibraryWriteOnly";
const AUDIO_RECORDING = "audioRecording";
const LOCATION_FOREGROUND = "locationForeground";
const LOCATION_BACKGROUND = "locationBackground";
const USER_FACING_NOTIFICATIONS = "userFacingNotifications";
const NOTIFICATIONS = "notifications";
const CONTACTS = "contacts";
const CALENDAR = "calendar";
const REMINDERS = "reminders";
const SYSTEM_BRIGHTNESS = "systemBrightness";
const MOTION = "motion";
// Deprecated constants
const CAMERA_ROLL = MEDIA_LIBRARY; // @deprecated Use MEDIA_LIBRARY or MEDIA_LIBRARY_WRITE_ONLY
const LOCATION = "location"; // @deprecated Use LOCATION_FOREGROUND or LOCATION_BACKGROUNDinterface PermissionResponse {
status: PermissionStatus;
expires: PermissionExpiration;
granted: boolean;
canAskAgain: boolean;
permissions: PermissionMap;
}
interface PermissionMap {
[permissionType: string]: PermissionInfo;
}
interface PermissionInfo {
status: PermissionStatus;
expires: PermissionExpiration;
granted: boolean;
canAskAgain: boolean;
accessPrivileges?: 'all' | 'limited' | 'none'; // iOS only - Media Library
scope?: 'whenInUse' | 'always' | 'none';
android?: PermissionDetailsLocationAndroid;
}
interface PermissionDetailsLocationAndroid {
accuracy: 'fine' | 'coarse' | 'none';
}
// The following types are imported from 'expo-modules-core':
enum PermissionStatus {
/** User has granted the permission. */
GRANTED = 'granted',
/** User hasn't granted or denied the permission yet. */
UNDETERMINED = 'undetermined',
/** User has denied the permission. */
DENIED = 'denied',
}
/** Permission expiration time. Currently, all permissions are granted permanently. */
type PermissionExpiration = 'never' | number;