flutter_android_enterprise 0.1.1
flutter_android_enterprise: ^0.1.1 copied to clipboard
Android Enterprise and managed-device APIs for Flutter — managed configuration, kiosk mode, compliance reporting, and profile awareness.
flutter_android_enterprise #
Android Enterprise / managed-device APIs for Flutter — managed configuration, kiosk mode, compliance reporting, and profile awareness.
Wraps DevicePolicyManager, RestrictionsManager, and androidx.enterprise.feedback with a clear split between capabilities available to any app and those that require Device Owner / Profile Owner provisioning. Methods that need provisioning throw instead of silently returning a default.
Feature matrix #
| Capability | Native API | Min API | Requires Device Owner? |
|---|---|---|---|
isDeviceManaged() |
DevicePolicyManager |
21 | No |
isManagedProfile() |
UserManager.isManagedProfile() |
21 | No |
isDeviceOwnerActive() |
DevicePolicyManager.isDeviceOwnerApp() |
21 | No |
getManagedConfigurations() / restrictions stream |
RestrictionsManager |
21 | No (app restrictions can be pushed without full DO) |
startKioskMode() / stopKioskMode() |
Lock Task API | 21 (23 for full behavior) | Recommended; falls back to screen pinning |
reportComplianceState() |
androidx.enterprise.feedback.KeyedAppStatesReporter |
21 | No |
isPrivateSpaceRestricted() / setPrivateSpaceAllowed() |
UserManager.DISALLOW_ADD_PRIVATE_PROFILE |
35 | Yes |
getUserProfiles() (full enumeration) |
UserManager.getUserProfiles() |
21 | Yes for full list |
No app can detect that it is currently running inside Private Space — that is an intentional Android privacy boundary, not a gap in this plugin.
Quick start #
dependencies:
flutter_android_enterprise: ^0.1.1
import 'package:flutter_android_enterprise/flutter_android_enterprise.dart';
final enterprise = EnterpriseManager();
// Works for any app, no provisioning required
final managed = await enterprise.isDeviceManaged();
final workProfile = await enterprise.isManagedProfile();
if (await enterprise.isDeviceOwnerActive()) {
final config = await enterprise.getManagedConfigurations();
// Apply config in your app (server URL, feature flags, etc.)
enterprise.restrictionsChanged.listen((cfg) {
// Handle IT-pushed restriction updates
});
// Replace with your app's package name
await enterprise.startKioskMode(allowedPackages: ['com.example.my_app']);
await enterprise.reportComplianceState(
ComplianceState.compliant,
'All checks passed',
);
}
Provisioning for local testing #
Most Device Owner APIs need a provisioned test emulator or device:
adb shell dpm set-device-owner com.example.flutter_android_enterprise_example/com.example.flutter_android_enterprise.DeviceAdminReceiverImpl
On OEM builds (Samsung Knox, Xiaomi MIUI, and others), Device Owner enrollment and DPM behavior can differ from AOSP — validate on target hardware before production rollout.
Documentation #
CHANGELOG.md— version history- API reference: pub.flutter-io.cn/documentation/flutter_android_enterprise
License #
MIT — see LICENSE.