Search code examples
web-applicationsaframewakelock

Stop iPhone from going to sleep while running A-Frame web app?


Bear with me if this is a stupid question, I'm very new to AFrame and VR, but also programming in general.

What I have gathered from google searches and the AFrame source code, is that Wakelock is built in. Great! Does this mean that while using my A-Frame web app, the power saving/autolock features on my phone should automatically be disabled?

If so, does anyone know why it would not be working? Doesn't matter how I view the page, safari/chrome, 'normal'/steroscopic, etc.. it goes to sleep anyway.

I have seen the other stack overflow question regarding this topic, but the only fix there was upgrading to Android 7.. which is obviously not the issue on my iPhone.

Thanks

UPDATE: Ok it seems this is genuinely impossible? I suppose I should have tested other webapps beforeheand. Phone locks using the AFrame demos, every other webapp I could find, as well as native apps like Google Cardboard demos. Guess all we can do is advise the users to change their settings themselves?? My boss will not be happy to hear that..

My only question now is whether I even understood the purpose of wakelock correctly in the first place?? Did it ever have the functionality that I'm talking about or have I totally misunderstood what its for?


Solution

  • There was a PR that recently merged for iOS/wakelock: https://github.com/aframevr/aframe/pull/2925

    Previously, iOS was refreshing every X secs due to the wakelock lib. It seems they have compromised to just let it sleep for now. Not sure if there is a more proper fix.