https://github.com/x-slayer/device_policy_manager
Query Android device Administrator (DevicePolicyManager)
https://github.com/x-slayer/device_policy_manager
android device-policy-manager flutter
Last synced: 9 months ago
JSON representation
Query Android device Administrator (DevicePolicyManager)
- Host: GitHub
- URL: https://github.com/x-slayer/device_policy_manager
- Owner: X-SLAYER
- License: mit
- Created: 2022-03-29T22:22:34.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-04-17T19:56:06.000Z (9 months ago)
- Last Synced: 2025-04-18T09:51:12.202Z (9 months ago)
- Topics: android, device-policy-manager, flutter
- Language: Dart
- Homepage: https://pub.dev/packages/device_policy_manager
- Size: 102 KB
- Stars: 16
- Watchers: 1
- Forks: 14
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# device_policy_manager
A flutter plugin to query Android device Administrator (DevicePolicyManager) particulary Locking screen
for more info check [DevicePolicyManager](https://developer.android.com/reference/android/app/admin/DevicePolicyManager)
### Installation and usage ###
Add package to your pubspec:
```yaml
dependencies:
device_policy_manager: any # or the latest version on Pub
```
Inside AndroidManifest add this to bind deviceAdmin receiver with your application
```
...
```
Create `policies.xml` inside `res/xml` and add the following code inside it:
```
```
### USAGE
```dart
/// Return `true` if the given administrator component is currently active (enabled) in the system.
final status = await DevicePolicyManager.isPermissionGranted();
/// request administrator permission
/// it will open the adminstartor permission page and return `true` once the permission granted.
/// An optional message providing additional explanation for why the admin is being added.
await DevicePolicyManager.requestPermession("Your app is requesting the Adminstration permission");
/// Remove administration permission from the current app.
await DevicePolicyManager.removeActiveAdmin();
/// Make the device lock immediately, as if the lock screen timeout has expired at the point of this call.
/// After this method is called, the device must be unlocked using strong authentication (PIN, pattern, or password).
await DevicePolicyManager.lockNow();
/// Determine whether or not the device's cameras have been disabled for this user.
final status = await DevicePolicyManager.isCameraDisabled();
```