Turn off GPS programmatically when i exit my program(退出程序时以编程方式关闭 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.
请务必在真机上测试您的应用,因为模拟器显示的 GPS 行为与真机不同.
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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:退出程序时以编程方式关闭 GPS
基础教程推荐
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
