在AlarmManager中获取活动的PendingIntent的列表


77

我有没有办法获取PendingIntent设备中活动目录的列表?

我开始工作,AlarmManager我想看看是否PendingIntent正确创建和删除了我的。

PendingIntent好奇还有什么,也很好奇,看看是否某些应用程序正在做一些“额外的工作”。

Answers:


170
adb shell dumpsys alarm > dump.txt

dump.txt:

Current Alarm Manager state:

  Realtime wakeup (now=1309361618777):
  RTC_WAKEUP #5: Alarm{4822f618 type 0 com.google.android.gsf}
    type=0 when=1309882326582 repeatInterval=522747000 count=0
    operation=PendingIntent{47dd3740: PendingIntentRecord{4822aeb8 com.google.android.gsf broadcastIntent}}
  ...
  RTC #5: Alarm{4810f9d8 type 1 com.tmobile.selfhelp}
    type=1 when=1309445979715 repeatInterval=86400000 count=1
    operation=PendingIntent{4815a5c8: PendingIntentRecord{4810f960 com.tmobile.selfhelp startService}}
  RTC #4: Alarm{4810f668 type 1 com.tmobile.selfhelp}
    type=1 when=1309445959620 repeatInterval=86400000 count=1
    operation=PendingIntent{480996e8: PendingIntentRecord{480214a0 com.tmobile.selfhelp broadcastIntent}}
  ...

  Elapsed realtime wakeup (now=2110632):
  ELAPSED_WAKEUP #5: Alarm{481c24e0 type 2 com.google.android.apps.maps}
    type=2 when=2147485512925 repeatInterval=0 count=0
    operation=PendingIntent{47d1d3a8: PendingIntentRecord{481a2600 com.google.android.apps.maps broadcastIntent}}     
  ...
  ELAPSED #1: Alarm{4829ce98 type 3 android}
    type=3 when=2512653 repeatInterval=0 count=0
    operation=PendingIntent{47eabda8: PendingIntentRecord{47f20250 android broadcastIntent}}
  ELAPSED #0: Alarm{480f0198 type 3 com.mixzing.basic}
    type=3 when=2439998 repeatInterval=0 count=0
    operation=PendingIntent{48100dd8: PendingIntentRecord{480ff5a0 com.mixzing.basic broadcastIntent}}

  Broadcast ref count: 0

  Alarm Stats:
  com.google.android.location
    3ms running, 1 wakeups
    1 alarms: act=com.google.android.location.ALARM_WAKEUP flg=0x4
  com.google.android.gsf
    274ms running, 4 wakeups
    1 alarms: flg=0x4
    1 alarms: act=com.google.android.intent.action.GTALK_RECONNECT flg=0x4
    2 alarms: act=com.google.android.intent.action.GTALK_HEARTBEAT flg=0x4
 ...
-------------------------------------------------------------------------------

1
哦,原来有一个。尝试使用dumpsys alarm。我已经更新了答案。
inazaruk 2011年

2
刚刚检查过,可以确认无法在设备上执行此操作,除非您具有root用户“权限拒绝:无法从pid = 16910,uid = 10120转储AlarmManager”
koi-feeding

1
什么财产主张?我的应用程序中存有大量信息这type=3 when=+4m7s342ms repeatInterval=300000 count=4703是否意味着已设置4703个警报?
Sergii Pechenizkyi

1
@plastiv-用于重复警报,count测量应触发警报的次数,但不是(例如,由于电话处于睡眠状态)。如果为count > 1,则至少错过一次警报。因此,repeatInterval=300000 count=4703意味着应该每5分钟重复一次闹钟,但错过了4702次警报-我猜手机已经关机了几天。
kamituel

1
@ koi-feeding-我不扎根,运行转储命令也没有任何问题(运行Motorola Moto G)
RTF 2014年

3

亚行shell dumpsys警报> dump.txt是解决方法,您不需要root权限。但是,从上面得到的东西可能很难理解。为了完全理解转储,您应该在这里查看morphatic的答案。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.