Android disables the display while charging… here is a solution to the problem.
Android disables the display while charging
In my app, I need to disable showing power off while the device is charging. There is an option to disable it in the Developer Menu, so I can send an intent for the user to enable it.
I also found information about PowerManager and WakeLocks, but I think it’s for alerting. What I have to deal with is device charging.
What is better, or is there another way?
Best Solution
I’ve done this with code:
final boolean isStayAwake = isStayAwakeEnabled(context);
if (!isStayAwake) {
intent = new Intent(ACTION_APPLICATION_DEVELOPMENT_SETTINGS);
}
context.startActivity(intent);
The user must tick the “Stay awake” option
I used my own ACTION_APPLICATION_DEVELOPMENT_SETTINGS constant because the default constant doesn’t have “com”. prefix