Jump to content

[Unity] Using android Wake Lock to keep the main thread running when the screens are off after the user removed the headset


Recommended Posts


I'm working with a Vive Focus 3 and for one of my projects I need to keep the Update running while the screens are off when a user remove the headset. To be precise I need to keep the update running from when the user presence switch to false and the Wave WVR_Event OnRenderingToBePaused is called until the activation of the sleep mode after the duration that we can set in the headset advanced settings.

My understanding was that using android wake lock and acquiring the wake lock before the screens turn off would keep the main thread running while the screens are off but in practice the Update still stops to run even if I’m acquiring the wake lock at the start of the app and never release it. I acquire the Wake Lock using Unity AndroidJavaClass and I added the wake lock permissions in the android manifest. To be sure I correctly acquired the wake lock I also used adb dumpsys on the power service and everything seems alright, I see the wake lock on my app.

Has anybody already achieved to do this successfully? Does the headset itself prevent you to do that and it’s impossible to keep the Update running when the user is not present or am I missing something?

For example, if the main thread continue to run, should I still received event like OnRenderingToBePaused ? It sometimes feels like Wave SDK is forcing to pause everything.


Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...