开发者

Turn off GPS programmatically when i exit my program

I have started my GPS programmatically by Intent myIntent = new intent(Settings.ACTION_SECURITY_SETTINGS开发者_运维问答); mContext.startActivity(myIntent);

How i will turn Off GPS when i exit from my program...


Try this:

locationManager.removeUpdates(myLocationListener);
locationManager = null;

This will shut down GPS for this app, but it is still available for use by other apps.

Be sure to test your app on a real phone because the emulator does not show the same GPS behavior as a real phone.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜