Android 启用和禁用 GPS

标签 android gps

<分区>

Possible Duplicate:
Enable GPS programatically like Tasker

我是一名初学者 android 开发者。

我想通过单击按钮启用和禁用 GPS,而不运行此 Intent :

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

startActivity(in);

这让我进入了设置菜单。

是否有像在 android“电源控制”小部件中那样启用或禁用 GPS 的方法?

谢谢

编辑:

我说的这个widget是在android系统(1.6版)上的。有一个应用程序 (siriusapplications.com/powercontrolplus) 可以满足我的需求,并扩展 android 电源控制。我的问题是:这个人如何管理这个? –

最佳答案

我认为没有办法做到这一点。看这个question .您还可以找到一个很好的例子 here .基本上,您要做的是测试 GPS 是否已启用,然后将用户导航到适当的设置页面。

您所指的小部件可能可以直接访问 GPS 驱动程序。这意味着它只能在手头的设备(或单个设备系列)中工作。

关于Android 启用和禁用 GPS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4015094/

相关文章:

python - 如何最好地使用 GPS 数据?

android - Jetpack 撰写 : LazyColumn not updating with MutableList

Android 问题找出最近最新的 GPS 修复是怎样的

android - GPS 值从 deg 格式转换为 dms 格式

java - Android中线程的合理使用

web-services - 移动设备的地理定位服务

android - map View 上 isRouteDisplayed() 的后果

java - "You need to use a Theme.AppCompat theme (or descendant) with this activity."

Android:从android gallery app中选择后从mediaStore获取路径

android - 如何检测 SELinux 是否在 Android 应用程序中启用?