Search This Blog

Wednesday, December 26, 2012

Keep screen on when the Activity running using power manager

First of all make the object of the Power manage.

protected PowerManager.WakeLock mWakeLock;

Now in onCreate method use the following to make the screen ON in the particular activity.

final PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
this.mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "My Tag");

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.