2017-02-13 23 views
1

我想要一个应用程序,当用户打开我的应用程序的用户将得到在我的应用程序的当前位置,同时用户改变自己的位置,也将一些特定的时间后更新。 我改变位置的解决方案,同时用户改变自己的位置,但我需要显示的用户的当前位置,同时用户打开我的应用程序如何显示的用户的当前位置,同时打开我的应用程序

+1

的可能的复制[?如何以编程方式获取当前GPS位置的Android(http://stackoverflow.com/问题/ 1513485 /如何获得当前的GPS位置编程在Android) –

+0

到目前为止你做了什么?请添加代码。 – tahsinRupam

回答

4
googleMap.setMyLocationEnabled(true); 
Location myLocation = googleMap.getMyLocation(); 

这些是获取当前位置的关键线。

更多信息,请参阅这些教程: android show current location on map using google maps api

how to get current location in google map android

+0

无法正常工作。它显示纬度:0.0和经度:0.0 –

+0

但是,链接对我来说工作得很好。然后参考这些链接,http://javapapers.com/android/get-current-location-in-android/,http://clover.studio/2016/08/09/getting-current-location-in-android -using-location-manager/ – Liya

+1

它工作[Android使用谷歌地图API在地图上显示当前位置](http://javapapers.com/android/android-show-current-location-on-map-using-google-maps -api /)当我在不同devices.Thanks上运行它 –

相关问题