screen_lock_plugin 0.0.3
screen_lock_plugin: ^0.0.3 copied to clipboard
A Flutter plugin that allows you to lock the Android device screen programmatically using Device Admin permissions.
0.0.3 #
- Screen on/off events are now delivered by a dedicated foreground service (
ScreenEventService) so they keep firing when the host app is backgrounded or running under background / FGS restrictions - Multi-source screen state detection:
ACTION_SCREEN_ON/ACTION_SCREEN_OFFbroadcasts +DisplayManagerdisplay-state changes + aPowerManager.isInteractivepolling fallback, de-duplicated into a single event stream - Adaptive foreground service type on Android 14+:
systemExemptedwhen the app is the device owner (kiosk),specialUseotherwise, with the requiredPROPERTY_SPECIAL_USE_FGS_SUBTYPEdeclared in the manifest - Persistent low-importance notification ("Screen monitor active") keeps the monitoring service alive
- New Android permissions declared:
FOREGROUND_SERVICE,FOREGROUND_SERVICE_SPECIAL_USE,FOREGROUND_SERVICE_SYSTEM_EXEMPTED,POST_NOTIFICATIONS - Errors starting the foreground service are now surfaced on the event stream as
FGS_START_FAILEDinstead of being silently dropped - Example app: request
POST_NOTIFICATIONSon startup, show notification permission status, and tap the "Last screen event" label to see the last 10 events with timestamps
0.0.2 #
- Add screen state query (
isScreenOn) - Add screen on/off event stream (
onScreenStateChanged) - Example app updated to display screen state and listen to events
0.0.1 #
- Initial Android plugin code
- Request admin permission
- Request if app has admin permission
- Lock device logic