0 purchases
user permission
user_permission #
This plugin provides Android applications with the ability to obtain the status of special app access and detect changes. Specifically, it has the following functions:
Get status of special app access:
This plugin checks whether the app has been granted special app access permission.
Launch screen for status change:
It has the ability to launch the settings screen required for granting special app access. Through this plugin, users can access the settings screen to easily grant the necessary permissions to the app.
Detect status change:
It can detect changes in the status of special app access in real time. This allows you to automatically return to your app from the settings screen.
Platform Support #
Android
✅
Supported User Permissions #
User Permission
Note
Usage access
Display over other apps
Picture-in-picture
Modify system settings
Alarm & reminders
When this user permission is turned off, your app process will be terminated.
Accessibility
When this user permission is turned off, your app process will be terminated.
Usage #
To use this plugin, add user_permission as a dependency in your pubspec.yaml file.
Get status #
import 'package:user_permission/user_permission.dart';
import 'package:user_permission/user_permission_type.dart';
final state = await UserPermission().state(UserPermissionType.usageStats);
copied to clipboard
Launch screen & Detect status change #
import 'package:user_permission/user_permission.dart';
import 'package:user_permission/user_permission_type.dart';
final state = await UserPermission().startWatching(UserPermissionType.systemAlertWindow);
copied to clipboard
Status value #
The status can be either denied or granted.
If denied, it's a good idea to ask the user for permission with startWatching.
import 'package:user_permission/user_permission.dart';
import 'package:user_permission/user_permission_type.dart';
final userPermission = UserPermission();
final state = await userPermission.state(UserPermissionType.usageStats);
if (state.isDenied) {
await userPermission.startWatching(UserPermissionType.usageStats);
}
copied to clipboard
Learn more #
API Documentation
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.