Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

233
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!