Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Avoid android from shutting screen off while app (with Phonegap) is on

I'm programming an Android application, and I would like to do so that it doesn't shut down the screen, ever.Pretty much like a car gps app that keeps the screen on.

Would someone know how to do this with phonegap ?
If its not possible in Javascript, is there an easy way to do it in Java but inside the main Phonegap function ?

Thank you

like image 858
Andrei Avatar asked Dec 19 '11 04:12

Andrei


1 Answers

use this property in the ManiFestFile

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

and add this in the required Activity

 getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
like image 188
RajaReddy PolamReddy Avatar answered Oct 02 '22 15:10

RajaReddy PolamReddy