Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

255
Vistas
What the "rotation" in expo-sensors' DeviceMotion returns exactly?

I'm building an App where I need to rely on compass azimuth/bearing/heading whatever you call it: the angle between the North and the Y-axis of the phone.

I read the greater half of the Internet and learned about "Sensor fusion" and it's virtual form of ROTATION_VECTOR in Android. I got familiarized with SensorManager and DeviceMotionModule.

Boiling it down to expo-sensors' DeviceMotion, my test code looks like so:

import { DeviceMotion } from 'expo-sensors'

DeviceMotion.addListener( ({ rotation }) => 
  console.info( ( 360 + this.toDegreesInt( rotation.alpha ) ) % 360 ) 
)

Now if I rotate the device, the value changes somehow, but if I point it to the North, I get an angle of 124 degrees which is far beyond the uncalibrated compass reading.

Also, if I rotate the device 360 degrees, the supposed azimuth value never goes from 0 to 359, but rather in some randomly spread chunks.

Google Navigation on the very same device works like charm...

How can I make my compass work?

about 4 years ago · Santiago Gelvez
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda