Avoid android turning off the screen when the application is on (using Phonegap)

I am programming an Android application, and I would like to do this so that it does not close the screen, ever. By and large, this is a GPS device app that supports the screen.

Does anyone know how to do this with telephony?
If this is not possible in Javascript, is there an easy way to do this in Java, but inside the main Phonegap function?

thanks

+7
source share
1 answer

use this property in ManiFestFile

<uses-permission android:name="android.permission.WAKE_LOCK"/> 

and add this to the desired activity

  getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); 
+15
source

All Articles