2011-01-19 66 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);