android, check gps position if near/close to certain position

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-06 03:42:11

问题


I've got sqlite database/table with gps locations (latitude and longitude).

Now I need the gps to check every few seconds if I'm near, so close to one of the positions within my database.

what would be the best/easiest way to do this? Can anyone give some guildlines or maybe an example/turturial on how to do this?


回答1:


Using the Location Managers Proximity Alerts would be your best bet, you can set an alert for each location in your table and then catch the intent when they are fired.

These are much more battery efficient than manually hitting gps on some interval.

Here is one example to get the idea.



来源:https://stackoverflow.com/questions/12099589/android-check-gps-position-if-near-close-to-certain-position

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!