简体   繁体   English

监控Android设备上的GPS使用情况

[英]Monitor GPS Usage on Android Device

I am trying to set up a monitoring functionality on an Android device. 我正在尝试在Android设备上设置监视功能。 I would like to monitor the actual usage of the GPS sensor on the phone. 我想监视手机上GPS传感器的实际使用情况。 This means I am primarily not interested in when the user turns the GPS sensor on/off, but when he uses GPS data through any given app (eg maps, location based search). 这意味着我主要对用户何时打开/关闭GPS传感器不感兴趣,而对用户何时通过任何给定应用程序使用GPS数据(例如地图,基于位置的搜索)不感兴趣。

I have tried the approach mentioned in Get GPS start/stop events with addGpsStatusListener , however, unsuccessfully. 我尝试使用addGpsStatusListener获取GPS启动/停止事件中提到的方法,但是未成功。

It is also unclear to me whether GPS_EVENT_STARTED means a resume from standby of the sensor, or simply reflects toggling the "allow GPS" in the settings by the user. 我还不清楚GPS_EVENT_STARTED是从传感器待机状态恢复还是仅反映用户在设置中切换“允许GPS”。 (see: http://developer.android.com/reference/android/location/GpsStatus.Listener.html ) (请参阅: http : //developer.android.com/reference/android/location/GpsStatus.Listener.html



Would someone know: 有人知道吗:

a) whether such a functionality is implementable/has already been implemented a)这种功能是否可以实现/已经实现

b) how this could be accomplished? b)如何做到这一点?


Many Thanks. 非常感谢。

After excessive testing of several approaches (a selection): 经过对几种方法的过度测试(选择):
How can I enable or disable the GPS programmatically on Android? 如何在Android上以编程方式启用或禁用GPS?
Android Enable and Disable GPS Android启用和禁用GPS
How to programmatically enable GPS in Android Cupcake 如何在Android Cupcake中以编程方式启用GPS
How to enable GPS in android coding 如何在Android编码中启用GPS

I found that on Android v4.2.2 it was indeed not possible to toggle the GPS status (regardless of what exactly the status implies, as also asked in my question). 我发现在Android v4.2.2上确实无法切换GPS状态(无论状态确切意味着什么,正如我所问的那样)。 I particularly found a comment in question How can I enable or disable the GPS programmatically on Android? 我特别发现了一个有疑问的评论,该如何在Android上以编程方式启用或禁用GPS? to be misleading . 产生误导 Even if the exploit with the power control widget should have reemerged in 4.2.2, it has since been fixed . 即使带有电源控制小部件的漏洞利用程序应在4.2.2中重新出现, 但此后已修复

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM