sleep mode ?!


hi all

is there a way to turn sleep mode off in android? o a way to control its timer programmatically?
I really need my app to run all the time (or at least 1 hr) and devices only allow for 10 mins max on the sleep mode timer

hope u can help me!



1 Like

In the coe Android / Java SDK, you would use a wake lock… I’m not sure if there’s a call to that from oFAndroid…


so if you include this in your manifest you can set system settings from the Main Activity:

<uses-permission android:name="android.permission.WRITE_SETTINGS"/>  

you can do something like this to set the system settings

android.provider.Settings.System.putInt(getContentResolver(),android.provider.Settings.System.SCREEN_BRIGHTNESS, brightness);  

You can look over all the system settings you can set here:

So you can set SCREEN_OFF_TIMEOUT and a few other things.

1 Like

actually once you’ve set the permission in the manifest you can call:




from c++ code to lock and unlock sleep

1 Like
Is there an example or instructions somewhere on the "right" way to handle Android interrupting an OF program?

thank you both!!
ofxAndroidUtils FTW!

* )