2011-01-19 76 views
0

我正在開發一個應用程序..當我啓動應用程序時,我的GPS已啓用,但在退出時應禁用GPS。怎麼做?請幫忙GPS禁用功能

回答

0

我不認爲它不可能。

嘗試這樣:

LocationManager.removeUpdates(LocationListener); 

我希望這是你在找什麼。

+0

我做過同樣的事情。它的工作:) – Angel 2011-01-19 10:06:42

0

你不必禁用什麼,只是使用位置管理器中刪除gpsupdate .. 這裏爲

(的LocationManager)getSystemService(Context.LOCATION_SERVICE).removeUpdates(mLocListener)代碼;

2

您可以禁用GPS由給定code.It運作良好。

Intent intent = new Intent("android.location.GPS_ENABLED_CHANGE"); 
intent.putExtra("enabled", false); 
sendBroadcast(intent);