android - Force Screen On -


How can I force the screen to remain active and not be closed when my app is turned on?

Please do not use a wake lock

It is required that you have an additional permission from your app, and it is very easy to present bugs, where you suddenly stay awake and leave the screen on it.

This window is far better to use the flag, FLAG_KEEP_SCREEN_ON , which you can do in your onCreate () Can enable:

 @Override Protected on Zero (Bundle Extractor) {super.onCreate (icicle); . GetWindow () addFlags (WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } 

This will ensure that the screen remains in the foreground of your window only, and only as long as it is in the foreground, it makes this case of general use very simple, any joke There is a need to destroy what you want to do in the form of your app transition between the states.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -