Skip to content
pubscout

device_policy_manager

1.0.0, released 2 years ago by iheb.tech

Query and manage Android device administrator policies and lock the screen.

WASM-ready
$ flutter pub add device_policy_manager
Source repository

What it does

Allows Flutter apps to interact with the Android DevicePolicyManager. It enables requesting device administrator permissions, locking the device immediately, checking permission status, removing admin privileges, and checking camera status.

AI-written summary of version 1.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to lock the Android device programmatically from your app.
  • Your application requires Android device administrator privileges.

Skip it when

  • You are building for iOS or other platforms not supporting Android DevicePolicyManager.
  • You do not want to prompt the user for device administrator permissions.

Strengths

  • Provides straightforward methods to lock the screen and manage admin permissions.
  • Simple integration via static methods.

Weaknesses

  • Limited to Android platform.
  • Requires manual configuration of native AndroidManifest.xml and policies.xml files.

Setup

Kind
Plugin (native code)
Effort
Medium
Code generation
No
Direct dependencies
0

Requires adding a receiver to AndroidManifest.xml and creating a policies.xml file inside res/xml.

final status = await DevicePolicyManager.isPermissionGranted();
await DevicePolicyManager.requestPermession("Your app is requesting the Adminstration permission");
await DevicePolicyManager.lockNow();

Alternatives

Packages that do the same job and could replace device_policy_manager.