Using gps get the distance a person has walked

前端 未结 3 2034
北荒
北荒 2020-12-18 11:20

guys i am able to get the current location longitude and Latitude using the below code. I have two buttons Start walking and Stop Walking.

Onclick of

3条回答
  •  梦毁少年i
    2020-12-18 12:09

    You can calculate distance between two geo locations with distanceTo() function
    Location destination =new Location("gps");
    destination.setLatitude(lat);
    destination.setLongitude(lng);
    float dist=user_location.distanceTo(destination);

提交回复
热议问题