在這段代碼中我要求從GPS如何偵聽來自多個提供者的位置更新?
locMan.requestLocationUpdates(LocationManager.GPS_PROVIDER,20000, 1, gpsListener);
位置更新,但我怎麼能確保它偵聽WiFi或手機ID更新嗎?
在這段代碼中我要求從GPS如何偵聽來自多個提供者的位置更新?
locMan.requestLocationUpdates(LocationManager.GPS_PROVIDER,20000, 1, gpsListener);
位置更新,但我怎麼能確保它偵聽WiFi或手機ID更新嗎?
對於其他供應商,您應該能夠呼叫requestLocationUpdates()
,其中有明顯的LocationListener
對象。
謝謝。有一個解決方案鏈接在這裏:http://stackoverflow.com/questions/1801866/problem-while-implement-location-listener-in-android-appwidget – Pentium10 2010-06-24 20:44:50
其實,你可以共享同一個監聽器。只需在偵聽器中使用Location.getProvider()來找出哪個提供程序生成了更新。
看看這個問題和answeir - http://stackoverflow.com/questions/4595522/use-gps-and-network-provider-at-the-same-time-in-android – 2015-10-22 10:38:19