Forum Discussion
ProfessorTroy
10 years agoAdventurer
What event am I looking for when the phone is disconnected from the Headset?
Hey!
Might be early, I'm totally not seeing an answer to this anywhere. One of the items I need to fix up for my game is that it doesn't properly shut down when removed from the headset.
I can't find an event for what would be a seemingly easy thing to fix. Easy answer for someone I suspect.
Might be early, I'm totally not seeing an answer to this anywhere. One of the items I need to fix up for my game is that it doesn't properly shut down when removed from the headset.
I can't find an event for what would be a seemingly easy thing to fix. Easy answer for someone I suspect.
10 Replies
Replies have been turned off for this discussion
- ProfessorTroyAdventurerFigured it out myself.
The events in OVRManager have been reliable in letting me know when the headset is pulled off and the phone is pulled out. - Swamp7hingProtegeWouldn't mind a little help here - if you're developing in Unity and using C# could you shed some light on how you went about fixing this? I've got the same item to fix on my test.
- ProfessorTroyAdventurerYes, I'm using Unity3D and C#.
In the OVRManager, there are a few events in there you want to listen for. Should they be triggered, you want to either suspend/pause and/or exit depending on what is done. If you have the
I don't have my source code handy with me right now, but I had to listen so I could pause and properly stop my sounds from playing, because I would notice background music still going if I removed the headset, which I shouldn't (for example). - Swamp7hingProtegeThe background music continues for a few seconds until the Gear registers the set has been removed before pausing. I can't control how long it takes for the isHMDPresent call to execute so I don't think I can control the audio pause time as it happens when the OVR SDK realizes the headset has been removed. When the phone is removed from the Gear VR entirely the app closes and does not exist in the Recent Apps drawer. Is this the expected behavior?
- vrdavebOculus Staff> I had to listen so I could pause and properly stop my sounds from playing
You can add event handlers to OVRManager like this:public class EventTester : MonoBehaviour
{
void Start()
{
OVRManager.HMDAcquired += () => Debug.Log("HMDAcquired");
OVRManager.HMDLost += () => Debug.Log("HMDLost");
OVRManager.HMDMounted += () => Debug.Log("HMDMounted");
OVRManager.HMDUnmounted += () => Debug.Log("HMDUnmounted");
OVRManager.VrFocusAcquired += () => Debug.Log("VrFocusAcquired");
OVRManager.VrFocusLost += () => Debug.Log("VrFocusLost");
OVRManager.AudioOutChanged += () => Debug.Log("AudioOutChanged");
OVRManager.AudioInChanged += () => Debug.Log("AudioInChanged");
OVRManager.TrackingAcquired += () => Debug.Log("TrackingAcquired");
}
}Replace Debug.Log with whatever code you need to run when the event occurs.
> a few seconds until the Gear registers the set has been removed
There is a known issue with the Samsung VR Service causing this. Unfortunately, there isn't a great solution, but a future SystemActivities update may fix it.
> the app closes and does not exist in the Recent Apps drawer.
Yes, this is expected behavior. Normally, Gear VR apps are launched through the Oculus or Home apps and not via the Android launcher, so we require excludeFromRecents in the manifest. - Swamp7hingProtege@vrdaveb Awesome, thank you for the reply! Considering this, my app closing/phone removal behaves as expected in my new binary. How long does it normally take for your team to swap statuses from Under Review to Changes Requested so I can upload the fixed binary?
While you're here, another quick test question:My application is intended to run on S7 series devices; I have not optimized it for older devices in the test where FPS drops were flagged, as I am an independent developer and do not have the capital to invest in phones for testing purposes.
Is there any way to make my application exclusive to S7 devices and avoid downgrading it for compatibility with older devices to pass the Graphics test requirements for the S6 and below?
- vrdavebOculus Staff> How long does it normally take for your team to swap statuses
Sorry, but the process takes a long time and I have very little visibility into it. Your best contact for any issues there is probably support@oculus.com.
> Is there any way to make my application exclusive to S7 devices
Sorry, not sure. There are certainly apps, such as Netflix, which only work on S6 and newer. I will ask around about S7 exclusivity. - Swamp7hingProtege@vrdaveb thank you sir!
- vrdavebOculus StaffSounds like there is a way to block Note 4, but not S6. You will probably need to detect the device and use lower quality settings on less-powerful hardware.
- Swamp7hingProtegeSounds good - I'll get on this now. Thank you @vrdaveb!
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 2 years ago