Here's a nice way to make the screen stay on for a particular activity. Just put this in the onCreate method:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
It's nicer than the POWERLOCK method, which requires an additional permission in the manifest:
<uses-permission android:name="android.permission.WAKE_LOCK">
And in your Activity:
final PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
this.mWakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "My Tag");
this.mWakeLock.acquire();
//and when you're done with the WakeLock:
this.mWakeLock.release();
Showing posts with label android screen wakelock. Show all posts
Showing posts with label android screen wakelock. Show all posts
Sunday, July 3, 2011
Subscribe to:
Posts (Atom)