2
\$\begingroup\$

I currently program a game in which the user don't need to interact with the screen. Is there any way to keep the screen awake?

\$\endgroup\$

closed as off-topic by MichaelHouse Aug 6 '15 at 13:34

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Programming questions that aren't specific to game development are off-topic here, but can be asked on Stack Overflow. A good rule of thumb is to ask yourself "would a professional game developer give me a better/different/more specific answer to this question than other programmers?"" – MichaelHouse
If this question can be reworded to fit the rules in the help center, please edit the question.

3
\$\begingroup\$

One option is to use a wake lock. Example from the docs:

PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "My Tag");
wl.acquire();

// screen and CPU will stay awake during this section

wl.release();

I've got this answer from this stack overflow post. For detailed information go there.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.