How to keep the screen awake

Hi! I would like to ask how I can keep the screen awake while I use my application inside Android, I found different solutions all out of dated.
Thanks

A good start would be allowing the app to wake_lock the screen,
image
you can find that menu in:
Android > sketch permissions
I haven’t dont much testing with permissions (im fairly new to android processing) but maybe just having that box ticked keeps the phone awake


Doge

Useful start point @DogeMastr
this permission seems to be used to keep the cpu on while the screen is off, however useful!
Thanks

Check this: https://forum.processing.org/two/discussion/comment/51740/#Comment_51740

I believe you need to include:

 import android.os.Bundle;
 import android.view.WindowManager;
 import android.view.View;

Kf

1 Like

@chanof===

permissions is needed of course, but you have to ask by code:

getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

creating a thread for that.

importing what is required (WindowManager, Activity…); dont forget to unlock when onPause().