I am writing app in android and I need to change time of screen activity. In settings I have 3 possible variants:
1) screen always active; 2) screen always active while charging; 3) normal screen activity (using default android user settings)
For first variant I found solution:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
But if I understand right it works just for one Activity. How I can do it for all activities in my app? And what I should do for second and third variants? Can you help me with this? Thank you.