2011-12-15 103 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

回答