简短答案
location.distanceTo(anotherLocation)
我建议在setupMap中添加其他侦听器,以简单的方式获取所有位置更改。
mMap.setMyLocationEnabled(true);mMap.setonMyLocationChangeListener(this);
然后,在此侦听器中,您只需在当前位置和目标之间进行测量即可。距离,以米为单位。
@Overridepublic void onMyLocationChange(Location location) { Location target = new Location("target"); for(LatLng point : new LatLng[]{POINTA, POINTB, POINTC, POINTD}) { target.setLatitude(point.latitude); target.setLongitude(point.longitude); if(location.distanceTo(target) < METERS_100) { // bingo! } }}当然,你应该做活动
implements GoogleMap.OnMyLocationChangeListener



