2011-12-15 98 views
0

如何让我的应用程序在打开GPS位置后立即开始更新GPS位置?获取最准确的GPS位置

现在我有这样的代码:

locationManager.requestLocationUpdates(bestProvider,0 ,0, loc_listener); 
location = locationManager.getLastKnownLocation (bestProvider); 

这需要的最佳位置。我在手机上运行我的应用程序,并从今天早些时候获得了我的位置。

我希望我的应用在我第一次打开它时更新gps位置。

我一直在寻找这些线程:

What is the simplest and most robust way to get the user's current location on Android? Android find GPS location once, show loading dialog

但我有麻烦的布线一切。

+0

“将所有东西连接起来”,如将代码连接到接口中一样,或者不使用第一个`getLastKnownLocation`,而是在sat锁定之后最后一次获知? – 2011-12-15 17:18:41

回答