flutter_android_enterprise 0.1.0
flutter_android_enterprise: ^0.1.0 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 — in one actively maintained, federated plugin.
Android has rich Enterprise APIs (DevicePolicyManager, RestrictionsManager, androidx.enterprise.feedback) but no current, comprehensive Flutter wrapper. Existing packages on pub.flutter-io.cn are single-purpose and largely unmaintained. This plugin covers the surface a real MDM-deployed Flutter app actually needs.
Built and battle-tested against a production pathology-lab scanning app deployed on IT-managed Android devices.
Why this exists #
If you've shipped a Flutter app to a fleet of company-owned or MDM-provisioned Android devices, you've probably hit all of these:
- No way to know if the device is managed at all, short of hand-rolled platform channels
- No way to read IT-pushed configuration (server URL, feature flags, license key) without building your own backend
- No way to lock the app into kiosk/lock-task mode for dedicated-purpose devices
- No way to report compliance state back to the MDM console
- Confusing, contradictory information online about what Private Space and work-profile detection actually allow a regular app to do
flutter_android_enterprise wraps the real native APIs for all of this, with an explicit, honest split between capabilities available to any app and capabilities that require Device Owner / Profile Owner provisioning — no method silently returns false when what actually happened is "you don't have permission to know that."
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 |
See doc/PROFILE_AWARENESS.md for a detailed explanation of what's detectable and what isn't — in particular, no app can detect that it is currently running inside Private Space. That's an intentional Android privacy boundary, not a gap in this plugin.
Quick start #
dependencies:
flutter_android_enterprise: ^0.1.0
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();
enterprise.restrictionsChanged.listen((cfg) => applyRemoteConfig(cfg));
await enterprise.startKioskMode(allowedPackages: [selfPackageName]);
await enterprise.reportComplianceState(
ComplianceState.compliant,
'All checks passed',
);
}
Provisioning for local testing #
Most of this plugin's value sits behind Device Owner provisioning. Set it up on a test emulator or device with:
adb shell dpm set-device-owner com.example.flutter_android_enterprise_example/com.example.flutter_android_enterprise.DeviceAdminReceiverImpl
Full walkthrough, including zero-touch enrollment and OEM-specific gotchas (Samsung Knox, Xiaomi MIUI), in doc/PROVISIONING.md.
Documentation #
doc/ARCHITECTURE.md— package structure, Pigeon schema, module designdoc/API_REFERENCE.md— complete public API, models, exceptionsdoc/ROADMAP.md— 30-day build plan and post-1.0 roadmapdoc/PROVISIONING.md— Device Owner setup for testingdoc/PROFILE_AWARENESS.md— capability tiers, Private Space limitationsdoc/PERMISSIONS_PRIVACY.md— permissions required, privacy posturedoc/EDGE_CASES.md— OEM differences, API-level fallback behaviordoc/TESTING.md— unit, integration, and manual OEM testing strategydoc/RELEASE_AND_PUBLISHING.md— release checklist, pub.flutter-io.cn publishing stepsdoc/COMPLIANCE.md— how compliance reporting surfaces in MDM consolesCHANGELOG.md— version history- API reference (generated): pub.flutter-io.cn/documentation/flutter_android_enterprise
Enterprise support #
The plugin is free and open source (Apache-2.0). For teams running this in production, we offer an SLA-backed support tier covering provisioning consulting, custom compliance-report integrations for specific MDM vendors, and priority bug fixes. Contact: [your-support-email].
Roadmap #
See doc/ROADMAP.md for the full 30-day build plan and long-term maintenance strategy.
Contributing #
Contributions welcome. Please read CONTRIBUTING.md before opening a PR — in particular, any change touching DevicePolicyManager/UserManager behavior needs to note the minimum API level it was verified against.
License #
Apache-2.0 — see LICENSE.