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


- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01