我发现了一种从
这个论坛中找到活动地理围栏的方法。
使用:
adb shell service dumpsys activity service com.google.android.gms/com.google.android.location.internal.GoogleLocationManagerService
由于Geofences是由Google Play服务API处理的,因此从该服务中可以找到活动的Geofences。
以下是可能对您感兴趣的输出部分:
查看按包分组注册的地理围栏:
Geofencer State:
Registered geofences:
Active Geofences:
Package: com.google.android.gms Tag: geotimezone, count: 4
Geofence[CIRCLE id:time-zone-00e3f64-2 transitions:1 0.000000, 00.332665 10001260m, resp=900s, dwell=-1ms, @-1] it=5, d=UNKNOWN ? com.google.android.gms
Geofence[CIRCLE id:time-zone-00e3f64-3 transitions:1 00.170901, 00.000000 10001260m, resp=900s, dwell=-1ms, @-1] it=5, d=UNKNOWN ? com.google.android.gms
Geofence[CIRCLE id:time-zone-00e3f64-1 transitions:1 -00.209155, -00.000000 10001260m, resp=900s, dwell=-1ms, @-1] it=5, d=UNKNOWN ? com.google.android.gms
Geofence[CIRCLE id:time-zone-00e3f64-0 transitions:1 0.000000, -161.714795 10001260m, resp=900s, dwell=-1ms, @-1] it=5, d=UNKNOWN ? com.google.android.gms
...
计数器(记录特定地理围栏的活动次数):
Counters:
locationRequests: 2
locationReceived: 0
sentinelFenceUpdatesNonChre: 0
sentinelFenceUpdatesChre: 0
geofenceCountMaximum: 8
com.google.android.gms:geotimezone:
addGeofenceRequests: 1
removeGeofenceRequests: 0
geofenceEnters: 0
geofenceExits: 0
geofenceDwells: 0
geofenceCountMaximum: 4
transition/initial(1/5): 8
这个特定活动的sysdump
输出内容还有很多,但我只提取了我认为与具备地理围栏功能的应用程序调试最相关的部分。
如果你认为有必要,你也可以使用dumpsys ... | grep
来筛选你想要的内容。
adb shell dumpsys
无法帮助您。我还没有看过地理围栏API,但如果它允许您查询未完成的注册,您可以创建一个BroadcastReceiver
来执行查询并将内容转储到LogCat。然后,在需要查看日志时,从adb
**发出广播即可。如果您正在使用Android Studio,则可以将该内容放在debug/
源集中,而不会使其混杂在发布版本中。 - CommonsWareNotificationManager
,AlarmManager
)。这非常令人恼火。 - CommonsWare