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\$

1 Answer 1

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\$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.