获取 AlarmManager 中活动的 PendingIntents 列表

发布于 2024-11-17 12:14:37 字数 213 浏览 2 评论 0原文

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

我开始使用 AlarmManager,我想看看我的 PendingIntent 是否已正确创建和删除。

很高兴看到还有哪些其他 PendingIntent,就像好奇地想看看某些应用程序是否正在做一些“额外工作”一样。

I there a way to get 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".

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

甜点 2024-11-24 12:14:37
adb shell dumpsys alarm > dump.txt

转储.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
 ...
-------------------------------------------------------------------------------
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
 ...
-------------------------------------------------------------------------------
谁许谁一生繁华 2024-11-24 12:14:37

adb shell dumpsys 警报 > dump.txt 是可行的方法,您不需要 root 权限。但从上面得到的内容可能会非常难以理解。为了完全理解该转储,您应该在此处查看 morphatic 的答案。

adb shell dumpsys alarm > dump.txt is the way to go and you don't need root permission for that. But what you get from above could be very confusing to understand. In order to understand that dump completely you should check out morphatic's answer here.

巨坚强 2024-11-24 12:14:37

首先安装“adb”作为命令

1-打印

echo $path 

2-打开编辑器

vim /etc/paths

3-进入“插入”模式
单击“I”

4- 复制/粘贴环境变量示例:

/Users/abdallahandroid/Library/Android/sdk/platform-tools
/Users/abdallahandroid/Library/Android/sdk/platform-tools/adb
/Users/abdallahandroid/Library/Android/sdk/emulator

5- 按“Esc”,然后写入 + 冒号”:” 它将导航到编辑器的最后一行

6- 写入“wq” + 单击 Enter

7-关闭终端并再次打开,测试打印

echo $path

保存时打印错误“E212”的情况见

bug:vim 保存时打印“/etc/paths”E212:

第二:运行模拟器:

1-设置sdk的模拟器路径

/Users/abdallahandroid/Library/Android/sdk/emulator

(保存在paths中,然后重新启动终端)

2-运行特定的模拟器格式
emulator -avd avd_name

示例:

emulator -avd Pixel_4_API_28

如何打印待定意图

termnial write 以查看所有待定意图:

adb shell dumpsys alarm

First Install "adb" as command

1- print

echo $path 

2- open editor

vim /etc/paths

3- to make “insert” mode
Click on “I”

4- copy/past the environment variable example:

/Users/abdallahandroid/Library/Android/sdk/platform-tools
/Users/abdallahandroid/Library/Android/sdk/platform-tools/adb
/Users/abdallahandroid/Library/Android/sdk/emulator

5- Press ""Esc"" then write + write colon”:” it will navigate to last line of editor

6- write “wq” + click enter

7- close terminal and open again, test print

echo $path

Case when save print error "E212" see

bug: vim when save print "/etc/paths" E212:

Second: Run Emulator :

1- set path of emulator path of sdk

/Users/abdallahandroid/Library/Android/sdk/emulator

(Save in paths, then restart terminal )

2- to run specific emulator format
emulator -avd avd_name

Example:

emulator -avd Pixel_4_API_28

How To Print Pending Intent

termnial write to see all Pending Intent :

adb shell dumpsys alarm
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文