关闭GPS编程时,我退出我的程序 [英] Turn off GPS programmatically when i exit my program

查看:130
本文介绍了关闭GPS编程时,我退出我的程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我也开始了我的GPS编程方式 意图myIntent =新的意图(Settings.ACTION_SECURITY_SETTINGS); mContext.startActivity(myIntent);

I have started my GPS programmatically by Intent myIntent = new intent(Settings.ACTION_SECURITY_SETTINGS); mContext.startActivity(myIntent);

我将如何关闭GPS,当我从我的程序退出...

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

推荐答案

试试这个:

locationManager.removeUpdates(myLocationListener);
locationManager = null;

这将关闭GPS为这个应用程序,但它仍然是可供其他应用程序使用。

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.

这篇关于关闭GPS编程时,我退出我的程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆