Question

I was wondering how the magnetic sensor in android works. I downloaded an application in which you have to search "treasures" through a radar that the application offers. So you have to go to the points that appear in it...

How can I implement something like that?

I think that is probably a coordinates "map" in which you refresh your position and if your coordinates and the treasure coordinate are pretty similar, then you got it. But in the radar, when you move your mobile, then it moves too like a compass. So I thought that it has to control the magnetic sensor and rotate the map with the degrees that it indicates...

That is how I think that it is implementated. Any idea or suggestion?

Thanks

Was it helpful?

Solution

Literally every Android phone has both GPS and compass (or gyro) sensors. Combination of both is what you are searching for:

  • Use GPS to obtain exact coordinates to compare them against your map;
  • Compass or gyro is the type of sensor than give you a direction vector.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top