How to get coordinates of an address in android

后端 未结 5 2000
[愿得一人]
[愿得一人] 2021-01-30 04:29

How do i get gps co-ordinates of the location/address entered by user in android ?

5条回答
  •  走了就别回头了
    2021-01-30 05:10

    List
    addresses; addresses = geocoder.getFromLocationName(, 1); if(addresses.size() > 0){ double latitude= addresses.get(0).getLatitude(); double longitude= addresses.get(0).getLongitude(); }

    manifest permissions:-

    android.permission.INTERNET
    android.permission.ACCESS_COARSE_LOCATION
    android.permission.ACCESS_FINE_LOCATION
    android.permission.ACCESS_MOCK_LOCATION
    

提交回复
热议问题