本文介绍了获取AlarmManager活跃PendingIntents名单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有没有办法可以查看调试目的有效 PendingIntent S的列表中的设备?

我开始与 AlarmManager 来工作,我要看看我的 PendingIntent s的正确创建和删除

这也将是不错的,看看有什么其他 PendingIntent 是有,只是作为一种好奇心,想看看一些应用程序是做一些额外工作。

解决方案

 亚行外壳dumpsys报警> dump.txt
 

dump.txt:

 当前告警管理状态:

  实时唤醒(现= 1309361618777):
  RTC_WAKEUP#5:报警{4822f618类型0 com.google.android.gsf}
    类型= 0时= 1309882326582 repeatInterval重复= 522747000数= 0
    操作= PendingIntent {47dd3740:PendingIntentRecord {4822aeb8 com.google.android.gsf broadcastIntent}}
  ...
  RTC#5:报警{4810f​​9d8 1型com.tmobile.selfhelp}
    类型= 1时= 1309445979715 repeatInterval重复= 86400000数= 1
    操作= PendingIntent {4815a5c8:PendingIntentRecord {4810f​​960 com.tmobile.selfhelp startService}}
  RTC#4:报警{4810f​​668 1型com.tmobile.selfhelp}
    类型= 1时= 1309445959620 repeatInterval重复= 86400000数= 1
    操作= PendingIntent {480996e8:PendingIntentRecord {480214a0 com.tmobile.selfhelp broadcastIntent}}
  ...

  经过的实时唤醒(现= 2110632):
  ELAPSED_WAKEUP#5:报警{481c24e0 2型com.google.android.apps.maps}
    类型= 2时= 2147485512925 repeatInterval重复= 0计数= 0
    操作= PendingIntent {47d1d3a8:PendingIntentRecord {481a2600 com.google.android.apps.maps broadcastIntent}}
  ...
  ELAPSED#1:报警{4829ce98 3型机器人}
    类型= 3时= 2512653 repeatInterval重复= 0计数= 0
    操作= PendingIntent {47eabda8:PendingIntentRecord {47f20250安卓broadcastIntent}}
  ELAPSED#0:报警{480f0198型3 com.mixzing.basic}
    类型= 3时= 2439998 repeatInterval重复= 0计数= 0
    操作= PendingIntent {48100dd8:PendingIntentRecord {480ff5a0 com.mixzing.basic broadcastIntent}}

  广播的引用计数:0

  报警统计:
  com.google.android.location
    3ms的运行,1唤醒
    1报警:行为= com.google.android.location.ALARM_WAKEUP FLG =为0x4
  com.google.android.gsf
    274ms运行,4唤醒
    1报警:FLG =为0x4
    1报警:行为= com.google.android.intent.action.GTALK_RECONNECT FLG =为0x4
    2报警:行为= com.google.android.intent.action.GTALK_HEARTBEAT FLG =为0x4
 ...
-------------------------------------------------- -----------------------------
 

I there a way to view for debug purpose a list of the active PendingIntents in a device?

I am starting to work with AlarmManager and I like to see if my PendingIntents are created and removed correctly.

It would also be nice to see what other PendingIntents are there, just as a curiosity to see if some app is doing some "extra work".

解决方案
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
 ...
-------------------------------------------------------------------------------

这篇关于获取AlarmManager活跃PendingIntents名单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-10 22:02