首页 文章

检查纬度和经度是否位于地理围栏半径

提问于
浏览
1

我是'm working on an application. I need geo-fencing to check whether a particular latitude and longitude lies within a specific radius. I' m关于地理围栏的教程,但我的问题是 I dont know where to pass the latitude and longitude that I want to check

教程链接:

https://code.tutsplus.com/tutorials/how-to-work-with-geofences-on-android--cms-26639

2 回答

  • -2

    这里

    .setCircularRegion( LATITUDE, LONGITUDE, RADIUS)
    

    IntentService 检测到指定区域的转换(进入,退出或停留)时,将调用 onHandleIntent() 并且您可以执行操作(警报或任何其他操作)

  • 1

    如果你只想检查这个(不使用通知机制),你需要一些数学:

    (lat-center_lat)^2 + (lon - center_lon)^2 < radius^2
    

相关问题