存在開始從與以下方法的LocationManager獲取通知的可能性:安卓的LocationManager構造的尺蠖
requestLocationUpdates(String provider, long minTime, float minDistance, LocationListener listener, Looper looper)
文檔解釋了這句話的屬性:
provider the name of the provider with which to register
minTime minimum time interval between location updates, in milliseconds
minDistance minimum distance between location updates, in meters
listener a LocationListener whose onLocationChanged(Location) method will be called for each location update
looper a Looper object whose message queue will be used to implement the callback mechanism, or null to make callbacks on the calling thread
我不明白井如果我想用這種方法開始接收更新,則該類(的活套)的行爲。此外,我正在圍繞類LocationManager創建一個庫,並且在執行正常行爲之前,我需要做一些其他工作。比我需要的是開始接收對庫的LocationListener的更新,並且只有在某些條件被驗證時才執行正常的行爲。
爲了做到這一點,我需要知道如何模擬如果用戶開始使用上述方法接收更新時具有LocationManager的行爲。
我希望我很清楚。 有人可以幫我嗎?謝謝!
什麼是'MAIN_HANDLER'在做什麼?來自你傳遞給UI線程的'result'的位置在哪裏? – Suhas
主處理程序接收runnable並在ui/main應用程序線程中執行它。 –