2010-06-24 38 views
3

在這段代碼中我要求從GPS如何偵聽來自多個提供者的位置更新?

locMan.requestLocationUpdates(LocationManager.GPS_PROVIDER,20000, 1, gpsListener); 

位置更新,但我怎麼能確保它偵聽WiFi或手機ID更新嗎?

+0

看看這個問題和answeir - http://stackoverflow.com/questions/4595522/use-gps-and-network-provider-at-the-same-time-in-android – 2015-10-22 10:38:19

回答

3

對於其他供應商,您應該能夠呼叫requestLocationUpdates(),其中有明顯的LocationListener對象。

+0

謝謝。有一個解決方案鏈接在這裏:http://stackoverflow.com/questions/1801866/problem-while-implement-location-listener-in-android-appwidget – Pentium10 2010-06-24 20:44:50

6

其實,你可以共享同一個監聽器。只需在偵聽器中使用Location.getProvider()來找出哪個提供程序生成了更新。

相關問題