Android的启用和禁用GPS [英] Android Enable and Disable GPS

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

问题描述

可能重复:
  启用GPS编程喜欢塔斯克

我是个初学者Android开发者。

I'm a beginner android developer.

我想启用和禁用GPS用按一下按钮,但不运行这个目的:

I want enable and disable GPS with a click of a button, without running this intent:

intente in = new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);   

startActivity(in);

这使我在设置菜单。

有没有一种方法来启用或禁用GPS作为在Android的功率控制窗口小部件?

Is there a method to enable or disable GPS as in the android "Power Control" widget?

感谢

编辑:

这是我说的小部件是在Android系统(前向1.6版本)。有一个应用程序(siriusapplications.com/powercontrolplus),让想我想要做的,并扩展了Android电源控制..我的问题是:如何persor可以管理这个? -

The widget that I said is in the android system (version 1.6 on forward). There is an application (siriusapplications.com/powercontrolplus) that make want I want do, and extend the android power control.. my question is: how this persor can manage this?? –

推荐答案

我不认为有一种方法可以做到这一点。看到这个<一href="http://stackoverflow.com/questions/1051649/how-to-programmatically-enable-gps-in-android-cupcake">question.您还可以找到一个很好的例子这里 。基本上,你做的是测试如果GPS已启用,然后导航用户到相应的设置页面。

I don't think there is a way to do so. See this question. You can also find a nice example here. Basically what you do is test if GPS is enabled and then navigate user to the appropriate settings page.

你指的是小部件可能直接访问GPS驱动器。这就是说,只有将手头工作在设备(或在一个单一器件系列)。

The widget you are referring to probably has direct access to the GPS driver. This means that will only work in the device at hand (or in a single family of devices).

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

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