cancel
Showing results for 
Search instead for 
Did you mean: 

Proximity sensog

INTETACTIVELABD
Honored Guest
Is any way to access proximity sensor of Gear VR?

Or any other way to determine that user had wore the spectacles?
17 REPLIES 17

EquipCodes
Honored Guest
I'd like to know this as well. This way I could make the screen slowly fade on from black whenever someone puts the Gear VR on.

cybereality
Grand Champion
I believe there is a way to do it, but it's not really documented or tested very well.
AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV

yosun
Honored Guest
You can use the usual android sensor enumeration to access the proximity sensor - the range is from 0 to 8... 8 being far proximity and 0 being close. TMG399X

However, I believe this seems to be just the sensor on the Galaxy Note 4 and not the proximity sensor on the Gear VR device?
ChallengePost: yosun SMS: 415-77-YOSUN Twitter: @yosun Some old public hacks.

Mossberget
Honored Guest
Did anyone have any luck getting access to the proximity sensor or any other way to detect if the device is put on or not.

So far I've tried several different solution to this problem, neither OnApplicationFocus or OnApplicationPaused works in this case.

Another solution i tried was to see if the application paused in some way that isn't detected, but it just seems as the applications keeps running in the background as if nothing changed.

I also just tried to access the proximity sensor on the phone, this only resulted in it reading as always being far away.


For now as a very bad temporary work around I'm going to try to just use movement data from the OVR to detect if it has been put taken off, hopefully i can read this as if the Samsung Gear VR was moving to quick or jerky to be on the head.

Mossberget
Honored Guest
Ok small update, I've now tried to instead detect which state the screen is in, but is seems as this didn't work either.

Maybe a conclusion to all this can actually be that the screen is never turned of, and really just fades to a black color?

cybereality
Grand Champion
Have you tried OnPause(): http://developer.android.com/training/b ... using.html
AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV

Mossberget
Honored Guest
So far only the built in OnApplicationPause() function in Unity (which is supposed to work in the same way and works fine in other applications)

But it seems as the applications keeps running even when not wearing the headset, so I don't think that would work anyway.
As stated as before I think it only makes the screen color turn to black, not turning it off or anything else.

jkimovr
Honored Guest
Unfortunately there is no API that is exposed to us for fine grain control. This is Samsung level code that we can't access through the mobile SDK. If you're trying to change the distance at which the sensor is active there isn't a good way to do this.

If you're trying to determine whether the headset is on the user's face or not, you can try using - ovr_HeadsetIsMounted()

Mossberget
Honored Guest
Ah I see, that should work then I guess 😄
I'll look around and see if I can get it running in Unity then, since its not yet implemented. If something hasn't changed since this post viewtopic.php?t=23927