app_permission_manager 1.0.0
app_permission_manager: ^1.0.0 copied to clipboard
A Flutter plugin to check and request app permissions on Android and iOS using a unified and simple API.
app_permission_manager #
A lightweight Flutter plugin to manage app permissions on Android and iOS with a simple, unified API.
This plugin helps you check, request, and handle permission states without dealing with platform-specific complexity.
✨ Features #
- ✅ Check permission status
- ✅ Request permissions at runtime
- ✅ Detect permanently denied permissions (Android)
- ✅ Handle restricted & limited permissions (iOS)
- ✅ Open app settings when required
- ✅ Android & iOS support
- ✅ Simple and clean API
📦 Supported Permissions #
enum AppPermissionManagerPermission {
camera,
microphone,
location,
locationAlways,
storage,
photos,
notifications,
contacts,
phone,
}
📱 Permission Status
enum AppPermissionManagerStatus {
granted,
denied,
permanentlyDenied, // Android
restricted, // iOS
limited, // iOS Photos
}
🚀 Installation
Add this to your pubspec.yaml:
dependencies:
app_permission_manager: ^1.0.0
Then run:
flutter pub get
🧑💻 Usage
Request Permission :
final status = await AppPermissionManager.request(
AppPermissionManagerPermission.camera,
);
if (status == AppPermissionManagerStatus.granted) {
// Permission granted
} else if (status == AppPermissionManagerStatus.permanentlyDenied) {
// Open app settings
await AppPermissionManager.openAppSettings();
}
Check Permission Status :
final status = await AppPermissionManager.check(
AppPermissionManagerPermission.location,
);
Open App Settings :
await AppPermissionManager.openAppSettings();
🤖 Android Setup
Add required permissions to your app-level AndroidManifest.xml:
android/app/src/main/AndroidManifest.xml
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<!-- Android 13+ -->
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
🍎 iOS Setup
Add permission descriptions to your app’s Info.plist:
ios/Runner/Info.plist
<key>NSCameraUsageDescription</key>
<string>Camera access is required</string>
<key>NSMicrophoneUsageDescription</key>
<string>Microphone access is required</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Location access is required</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Location access is required even in background</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Photo library access is required</string>
<key>NSContactsUsageDescription</key>
<string>Contacts access is required</string>
🧪 Example App
A complete working example is available in the /example directory.
👨💻 Author
Manoj Patadiya
📧 Email: [email protected]
📄 License
This project is licensed under the MIT License.