关闭GPS编程 [英] Switch off GPS programatically

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

问题描述

我有什么:目前我的应用程序是通过GPS提供的位置

What i have: Currently my app is giving location through gps.

我想要什么: GPS来我从应用程序退出后自动关闭。因为它不断告诉我的位置,一次又一次,看起来奇怪的,也是全球定位系统消耗了大量的电池。

what i want: Gps to turn off automatically after i exit from the application. Because it keeps on telling me the location time and again that looks odd and also gps consume a lot battery.

请帮我在这方面的工作。 在此先感谢!

Kindly help me in this regard. Thanks in advance!

推荐答案

综观上述评论跟帖,似乎它可以关闭GPS编程(但看到只有12 Upvotes)

Looking at above comment thread it seems its possible to turn OFF GPS programatically (But seeing only 12 Upvotes)

但是如果你从你的应用程序切换关闭GPS编程,如果其他应用程序使用的GPS服务?

解决方案会像

The solution would be like

打开设置的机器人,然后告诉用户关闭GPS,当他从应用程序退出...

Open Settings of android and then tell user to turn OFF GPS when he exits from the application...

有关这一点,你可以这样做:

For this you can do like :

Intent i = new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(i);

您可以尝试像

locationManager.removeUpdates(myLocationListener); 
locationManager = null;

该关闭GPS进行这个程序,但它仍然可以通过其他应用程序使用。

This shutdown gps for this app, but its still available for use by other apps.

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

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