Oculus Go: How to keep awake while still in app - oculusgo

I'm working on an Oculus Go app, using Unity, where the user is literally expected to sleep while using the app and with the headset still on their head. I seem to be running into the problem where the Oculus Go goes into power-save mode because of inactivity. Presumably, the user isn't moving enough when they are in a deep sleep.
Although I've included instructions for the user on how to disable sleep as a device-wide setting, this is far from ideal. iOS has idleTimerDisabled (Keep iPhone from sleeping) which is a simple one-line stay-awake type of command. I'm looking for the Oculus Go equivalent of iOS's idleTimerDisabled
Does anyone have any hints on how to keep the Oculus Go from turning off?
Just to be clear, this stay-awake behavior should only happen while the user is wearing the headset and using the this app, and only this app. If the user takes off the headset, normal turn-off behavior should be immediately restored.
Thanks in advance,
JJ

Include
Screen.sleepTimeout = SleepTimeout.NeverSleep;
in your MonoBehaviour script if you just want keep the device awake while app is running and helmet is worn.
https://docs.unity3d.com/ScriptReference/Screen-sleepTimeout.html

As of May 2019, it is not possible to keep the Oculus Go awake. Oculus wrote to me
Unfortunately, this doesn't look to be functionality (disabling sleep when there is no movement) that is available at this time.

Related

VR application for the phone without using a button

I built the application, works fine. But now the boss wants the capability for users to concentrate on a point in the screen and it triggers an event. Call me an old fashioned dev but I haven't got a clue. Any insight would be appreciated.
First off, you really need to find out what your boss means by "... users to concentrate on a point in the screen and it triggers an event". There is no eye tracking capability (yet) build into any VR HMD. That might end the vague request right there.
OTOH - what most apps do that need some user input without using any buttons is called "gaze tracking" or "gaze input" but what it really is at this stage of VR development is if the user has centered the screen about some UI trigger, then you can (typically) show some hourglass-like object superimposed on the trigger in an obvious countdown mode. If the countdown goes off, the input is triggered. If the user "gazes away" (i.e. moves their head), you abort the countdown and turn off the UI visuals. Works best if there's a reticule that's either always on, or comes into focus when it's near a trigger. While reasonably intuitive, it's not my favorite technique, and it's got serious problems when you do it in a stereo scene, but a lot of apps currently use it. Get a GearVR and visit the Oculus store/apps, they do it as good as anyone, plus they have some nice documentation of best practices.

Sandbox Game Center Turn Event Notifications Not Consistent

I'm making a turn-based game, using the Game Center Turn-Based Gaming functionality. I'm using the simulator and my iPhone to test notifications of turn events. The results are very inconsistent. About 75% of the time when I make a move on the simulator and pass the turn I don't get any notifications on my iPhone. It seems that this function doesn't get called:
handleTurnEventForMatch:didBecomeActive:
I set the GKEventHandlerDelegate in the code that authenticates the local user and it seems to be set correctly. The fact that I get notifications once in a while suggests that this isn't where the problem lies.
Does anyone have any idea what could be the problem here? Could this be a problem with the Sandbox Game Center Server? Do they limit the amount of notifications you can send in a short amount of time or something like that?
Edit: I just found some posts of people experiencing the same problem, but no solution. No very recent posts though. Any updates?
Edit2: I also find that after a move, when I open the GKTurnBasedMatchmakerViewController on the other device it still says that it's the turn of the other player. When I close and reopen it the information is correct. Also, when I open the game GKTurnBasedMatchmakerViewController when it's still showing incorrect information, it does gives me the correct match object with the updated information. Could this be related in any way?
I thought I would share my solution with you, in the hopes that it is the same problem you are experiencing. As you can see from my comment to your question, I was having the same issue as you. It turned out that my settings in iTunes Connect were the culprit, unbeknownst to me. What you should check for is that you still have Game Center enabled in BOTH places that iTunes Connect requires. First, after going into "Manage my Apps" in iTunes Connect, select your app and on the right menu, and click "Manage Game Center". Make sure this is currently enabled. I would even recommend disabling it, and re-enabling it again for good measure.
In addition (and this is what I was missing), you must enable it in one more place. Go back to the previous screen when you first select the app. The top right is where you can select Manage Game Center, but we are looking on the bottom in the "Versions" section. Click the View Details button for your app, and make sure the Game Center button is enabled near the bottom. Again, I would disable and re-enable it here as well. Give it about 10 minutes, clear all your open turns and matches from the Game Center app (this might be an optional step), and build & run again. Hopefully, you will receive turn notifications properly again.
I got the same problem. However when i tested it on multiple devices it was working fine... May be some problem with the simulator

GKTurnBasedMatch push notifications are very inconsistent

I'm testing a turn based game between two devices. As far as I understand, sending a turn with [GKTurnBasedMatch endTurnWithNextParticipants:], for example, should automatically push a game center notification to the opponent. Sometimes, this works just as expected: the turn is sent and right away a banner notification shows up on the other device. All is well.
What is baffling me is that other times, even though the turn itself is sent properly (I can tell because when the opponent refreshes the matches, the match is up-to-date), there's no push notification coming in.
Are there any holes in my understanding here? If I'm understanding correctly, the inconsistent notifications shouldn't have anything to do with my code, because the issue here isn't how I handle notifications, it's that there is no notification at all. In other words, [handleTurnEventForMatch:] (aGKTurnBasedEventHandlerDelegate method) doesn't have anything to do with it (I don't think) because if no notification is being received, it's never going to be called anyway.
So, I'm just wondering if anyone has had any experience with this. Is it possible that this is due to something in my code? Or, is it possible that the Game Center sandbox is responsible for the inconsistencies, and there's nothing I can do about it?
Any thoughts or ideas would be much appreciated.
It is an issue with GameCenter's sandbox mode. In order for your device to enter sandbox mode you have to open/run your app and authenticate game center. If you say, open a different (published) game after your game is open it will leave sandbox mode and and go back to regular game center mode.
Even if your game is running in the background, as long as it is the last game-center enabled game opened you should get the push notifications as normal. But if you open the game, and then kill the process, you will no longer be in sandbox mode and will not receive the push notifications.
For those who are experiencing similar problems: this turned out to be a Game Center sandbox problem. It had nothing to do with my code, and things were fine in the App Store release. So, read through the comments here and make sure there aren't other things factoring into whatever issues you're having...but know that it's possible that you're simply experiencing some Game Center sandbox issues that are out of your control!
I am also facing the same problem. My game stops receiving turn events and turn notifications from Game Center, I finished my game and was testing, but this week, the problem started to happen. It was working like a charm but suddenly instances started not to receiving turn events for a couple of days.
I am using the iOS7 SDK and targeting iOS7 (turn event handling is different than prior iOS versions, I will need exchanges in upcoming game features, that's why I am using iOS7).
Then I made a test app to check if it was same with iOS6 and prior SDKs, but no help, it was same. So don't waste your time to upgrade your code to iOS7 hoping it would work, the problem is there. I also tried many things, like resetting devices and settings, using new users, etc.
I also tried it with Ray Wenderlich's Turn-Based Gaming with iOS 5 tutorial, by downloading source code, and it doesn't work neither.
The thing is, usually when I launch the game, game receives turn events, but after a few turns, it just stops, and when it stops receiving, stops like forever. If I reload the match, I can get the updated match and it's data is also updated, so I can make the turn. It means match is updated on Game Center. So, either Game Center is not pushing the data to users (possibly this is happening because user cannot receive notifications from Game Center when the game is in background), or the GameKit is not firing the event to the handler.
I don't know why it is happening, or why it started to happen, but I can't release my game like this, hoping that it would work out of sandbox. I will be trying a couple of more things (like maybe trying turn reminders of iOS7, to see if they push it to the user), then I will ask to Apple's support team. One other thing i am planning to do is, putting my test app to App Store and see it if works out of sandbox.
Hopefully it is a sandbox problem.

iPhone:don't want to exit game while ring/silent switch turns on from turns off mode

I am working on app in which audio file playing very vital role.
for playing audio file I am using AVaudioPlayer in my app.
but one problem is suppose device is in silent mode and user starts running the app
and suppose he/she turns on silent/ring switch in the middle of the app.
right now he/she must exit the game but I want such kind of functionality in
which He/she should not exit the app and in the middle of the app user should be
able to hear the sound when he turns on the ring/silent switch from the device.
iOS apps have the ability to play music in the background whether they be games or not, since multitasking was introduced in iOS.
See the following tutorial.
http://mobile.tutsplus.com/tutorials/iphone/ios-sdk_background-audio/
Whether its legit for a game to do this I seriously question. But thats your call.

Does the iOS let developers do this?

Let's say the user leaves the phone on the table. (probably on home screen)
A few hours later, he picks it up. And when it does, the iPhone detects the accelerometer, and it rings.
Unfortunately, this is not possible. Once the OS goes to the home screen, applications running in the background have a limited set of options.
Read this article for more information: http://developer.apple.com/library/ios/#DOCUMENTATION/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html
Not through officially accepted means (i.e. you could do it on a jailbroken phone conceivably). Primarily, you can't run in the background for that purpose. If the app was running in the foreground, you can easily detect motion and perform an activity - but if the phone is left for too long a period without activity, it will sleep.
Unfortunately, the accelerometer is not one of the specified keys in the UIBackgroundModes option in your apps info.plist.
auido, location and voip are the only ones available for now.
short answer: YES
The trick is to make sure the app doesn't get backgrounded when the phone goes to sleep. The other elements like detecting changes in the accelerometer and playing a sound are all standard features.
As for the no sleep solution, it has been asked before, basically is you play a music sample the app will continue running, so perhaps a loop of silence continuously played.
Only if you left an app designed for that purpose running in the foreground.
It won't be possible if your app is running in the background.