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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!