0

I'm looking at this question: How to detect Desktop vs. Mobile vs. GearVR vs. Oculus Rift vs. Vive in A-Frame?

It seems that AFRAME.utils.device.isMobile() is seeing the Go as a mobile device.

schatzkin
  • 319
  • 3
  • 17
  • 1
    Hi schatzkin, putting this as a comment as I’m not sure if it’s the best solution but something that works for me. if you look at aframe utils docs https://github.com/aframevr/aframe/blob/master/docs/core/utils.md there is a check for oculus go, this will not be available until 0.9 however. In the mean time, I find that checking if it’s a GearVR works for the go as well AFRAME.utils.device.isGearVR(). If you need to distinguish between go and gear that obviously won’t work. – Nick Oct 03 '18 at 07:58
  • Acutally, I don't have to distinguish between Gear and Go for this round, so this solution works for me. Thank you! – schatzkin Oct 03 '18 at 23:02

1 Answers1

1

The check will ship in A-Frame 0.9.0 (as one of the comments mentioned). In the meantime you can incorporate the code to your application:

function isOculusGo () {
  return /Pacific Build.+OculusBrowser.+SamsungBrowser.+MobileVR/i.test(window.navigator.userAgent);
} 

This checks relies on the specific navigator.userAgent strings of the browsers available on Go (Oculus Browser and Samsung Internet). It's not super robust but the only known way to do it at the moment. Mozilla Firefox Reality has just been released and the expression above does not take it into consideration. I don't have a Go available to access the userAgent.

Diego Marcos
  • 4,502
  • 3
  • 15
  • 20
  • I'm going with the solution above for now, I'll keep this in mind for my next iteration -- although maybe 0.9.0 will be released by then anyway. Thank you! – schatzkin Oct 03 '18 at 23:03
  • Ok. Keep in mind that the none of the suggested checks will detect Firefox Reality – Diego Marcos Oct 04 '18 at 15:43
  • Oculus Gear here has `Mozilla/5.0 (Linux; Android 9; SM-N960F) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/6.2.11.181027543 SamsungBrowser/4.0 Chrome/74.0.3729.182 Mobile VR Safari/537.36` - looks like it could be accidentally hit as well – Jonny Nov 13 '19 at 05:29