0
在我的應用程序中,只需點擊某個按鈕即可獲得Location
。我還需要註冊一個LocationListener
,還是我可以使用這個?需要註冊LocationListener?
LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
Location position = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
因此,使用'LocationListener.onLocationChanged(...)'將始終通過Wi-Fi,GPS,網絡提供商顯示當前位置? – 2012-07-26 20:24:58
它將打開您要求的任何位置提供程序,並返回您在onLocationChanged回調後獲得的第一個「修復」位置。 – Kaediil 2012-07-26 20:26:13
如果我要在'onPause()'中取消註冊監聽器,是否有助於節省電池壽命? – 2012-07-26 20:34:19