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

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

问题描述

可能重复:
像Tasker一样以编程方式启用GPS

我是一名初级安卓开发者.

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);

这让我进入了设置菜单.

that brings me in the setting menu.

有没有一种方法可以像在 android电源控制"小部件中那样启用或禁用 GPS?

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

谢谢

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

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?? –

推荐答案

我不认为有办法这样做.请参阅此问题.您还可以在这里找到一个很好的例子.基本上你要做的是测试是否启用了 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天全站免登陆