androidmobiletablet

Is there a way for an Android Tablet to enter an energy saving mode and wake from it without any user inputs?


I'm looking for a way to have an app run on an android tablet.

To be more specific, I'd like the app to visibly run in the foreground while the tablet is charging and while the tablet isn't charging, the tablet should go into some kind of energy saving mode. Once it starts charging again, I'd like the app to become visible again without any further inputs from the user.

Is there a way for this to work? The tablet is not locked by a password. I'd like a solution that is better than just having the app display a black screen while the tablet isn't charging.


Solution

  • I solved this issue by first setting up this screen wakeup listener

    https://androidexample.com/screen-wake-sleep-event-listner-service

    and then by using the KeyguardManager to unlock the device.

    I haven't tested whether this works over a longer slee period yet but hopefully it does.