-->

Check and enable Magnetic sensor calibration in An

2020-05-01 04:55发布

问题:

I'm using Magnetic Sensor calibration in my Android app to implement Augmented reality. When the app is used for a long time, the sensor calibration is reduced gradually. Is there any way to check the calibration and automatically enable or prompt the user to perform manual calibration again?

回答1:

Unfortunately for an AR type app I can't see how you can know if the magnetic sensor is correctly calibrated or not. Since there are lots of things which can cause the magnetic sensors to go out of alignment (see: https://stackoverflow.com/a/9583998/295004) one thing that a map/navigation app could do is use the GPS sensor to detect that the user is moving on XYZ road which has a compass bearing of x and if that doesn't match what the magnetic sensor says then that is an indicator to recalibrate.

For your AR app you may just want to have a splash screen state that if the user is having any rotation problems to do the figure 8 pattern and have your magnetic sensor on.