config/nativephp.php and requested at runtime when needed.
Configuring Permissions
Add permissions to thepermissions array in config/nativephp.php:
Permission Formats
Boolean values:true- Permission enabled with default system messagefalse- Permission disabled
- iOS: Custom message shown when requesting permission
- Android: Treated as
true(custom messages not supported)
Applying Changes
After modifying permissions, rebuild the native configuration:Common Permissions
Camera
Request camera access for photos, videos, or QR scanning:- iOS: Adds
NSCameraUsageDescriptionto Info.plist - Android: Adds
android.permission.CAMERAto AndroidManifest.xml
Location
Request location access for maps, geofencing, or location-based features:- iOS: Adds
NSLocationWhenInUseUsageDescriptionto Info.plist - Android: Adds
android.permission.ACCESS_FINE_LOCATIONandandroid.permission.ACCESS_COARSE_LOCATION
Microphone
Request microphone access for audio recording:- iOS: Adds
NSMicrophoneUsageDescriptionto Info.plist - Android: Adds
android.permission.RECORD_AUDIO
Photo Library
Request access to the user’s photo library:- iOS: Adds
NSPhotoLibraryUsageDescriptionto Info.plist - Android: Adds
android.permission.READ_EXTERNAL_STORAGE
Notifications
Request permission to send push notifications:- iOS: Requests notification permission at runtime
- Android: Automatically granted (Android 12 and below) or requested (Android 13+)
Biometrics
Request access to Face ID, Touch ID, or fingerprint authentication:- iOS: Adds
NSFaceIDUsageDescriptionto Info.plist - Android: Adds
android.permission.USE_BIOMETRIC
Bluetooth
Request access to Bluetooth for device pairing or communication:- iOS: Adds
NSBluetoothAlwaysUsageDescriptionto Info.plist - Android: Adds
android.permission.BLUETOOTHandandroid.permission.BLUETOOTH_CONNECT(Android 12+)
Contacts
Request access to the user’s contacts:- iOS: Adds
NSContactsUsageDescriptionto Info.plist - Android: Adds
android.permission.READ_CONTACTS
Calendar
Request access to the user’s calendar:- iOS: Adds
NSCalendarsUsageDescriptionto Info.plist - Android: Adds
android.permission.READ_CALENDARandandroid.permission.WRITE_CALENDAR
Platform-Specific Permissions
Some permissions are platform-specific and require custom configuration.iOS Info.plist Keys
For advanced iOS permissions not covered by the simple format, you can add custom Info.plist entries via a plugin:NSCameraUsageDescription- CameraNSPhotoLibraryUsageDescription- Photo library readNSPhotoLibraryAddUsageDescription- Photo library writeNSMicrophoneUsageDescription- MicrophoneNSLocationWhenInUseUsageDescription- Location (when in use)NSLocationAlwaysUsageDescription- Location (always)NSContactsUsageDescription- ContactsNSCalendarsUsageDescription- CalendarsNSRemindersUsageDescription- RemindersNSMotionUsageDescription- Motion & fitnessNSBluetoothAlwaysUsageDescription- BluetoothNSFaceIDUsageDescription- Face IDNSSpeechRecognitionUsageDescription- Speech recognitionNSHealthShareUsageDescription- Health (read)NSHealthUpdateUsageDescription- Health (write)
Android Permissions
For advanced Android permissions, add them via a plugin manifest:android.permission.CAMERA- Cameraandroid.permission.RECORD_AUDIO- Microphoneandroid.permission.ACCESS_FINE_LOCATION- Precise locationandroid.permission.ACCESS_COARSE_LOCATION- Approximate locationandroid.permission.ACCESS_BACKGROUND_LOCATION- Background location (Android 10+)android.permission.READ_EXTERNAL_STORAGE- Read filesandroid.permission.WRITE_EXTERNAL_STORAGE- Write filesandroid.permission.READ_CONTACTS- Read contactsandroid.permission.WRITE_CONTACTS- Write contactsandroid.permission.READ_CALENDAR- Read calendarandroid.permission.WRITE_CALENDAR- Write calendarandroid.permission.BLUETOOTH- Bluetooth (legacy)android.permission.BLUETOOTH_CONNECT- Bluetooth connect (Android 12+)android.permission.BLUETOOTH_SCAN- Bluetooth scan (Android 12+)android.permission.USE_BIOMETRIC- Biometric authenticationandroid.permission.ACTIVITY_RECOGNITION- Activity recognition (Android 10+)android.permission.POST_NOTIFICATIONS- Push notifications (Android 13+)
Requesting Permissions at Runtime
Some permissions must be requested at runtime when the user attempts to use a feature.Using NativePHP Facades
Most NativePHP facades automatically request permissions when needed:Manual Permission Requests
For custom permission handling, use the Permission facade:Permission Status
Permissions can be in one of several states:- Not Determined - User hasn’t been asked yet (iOS only)
- Granted - User granted permission
- Denied - User denied permission
- Restricted - Permission restricted by parental controls or device policy (iOS only)
Checking Permission Status
Handling Permission Denials
If users deny a permission, provide guidance on how to enable it in system settings:Opening System Settings
Direct users to your app’s settings page:Permission Best Practices
Request permissions in context
Request permissions in context
Always request permissions when the user is about to use a feature, not on app launch. This provides context and improves approval rates.
Explain why permissions are needed
Explain why permissions are needed
Provide clear, user-friendly explanations for each permission. Users are more likely to grant permissions when they understand the benefit.
Handle denials gracefully
Handle denials gracefully
If a permission is denied, provide alternative functionality or clear instructions on how to enable it.
Don't request all permissions upfront
Don't request all permissions upfront
Only request permissions as they’re needed. Requesting too many permissions at once can overwhelm users.
Test permission flows
Test permission flows
Test your app with permissions both granted and denied to ensure a good experience in all cases.
Update after configuration changes
Update after configuration changes
Always run
php artisan native:install --force after changing permissions in the config file.Plugin Permissions
Plugins can declare required permissions in theirnativephp.json manifest. These are automatically added to your app when the plugin is installed.
See Custom Plugins for details on configuring plugin permissions.
Next Steps
Camera & Photos
Learn how to use the Camera API
Location
Access device location