Kuwapp's Blog

Android と Flutter やってます

【Android】AlarmManagerで登録された通知をコマンドラインで確認する

ローカル通知を実装したが、通知が届かない。
Alarmの登録でバグがあるのか、レシーバーが上手く動いていないのか。。
問題の切り分けにけっこう使えます。

adb shell dumpsys alarm

端末を繋いでターミナルを起動し上記コマンドを実行します。
もちろんadbのパスを通す必要があります。

Realtime wakeup (now=2014-12-17 22:54:44):
  RTC_WAKEUP #9: Alarm{407cf0d0 type 0 com.google.android.partnersetup}
    type=0 when=+6d23h38m22s968ms repeatInterval=0 count=0
    operation=PendingIntent{407c50f0: PendingIntentRecord{407cd2d8 com.google.android.partnersetup startService}}
  RTC_WAKEUP #8: Alarm{40a7f548 type 0 com.google.android.gms}
    type=0 when=+5d1h41m0s353ms repeatInterval=0 count=0
    operation=PendingIntent{407dbe68: PendingIntentRecord{408b0ee8 com.google.android.gms broadcastIntent}}
  RTC_WAKEUP #7: Alarm{40a6e418 type 0 com.google.android.gms}
    type=0 when=+1d2h6m41s370ms repeatInterval=0 count=0
    operation=PendingIntent{40716f90: PendingIntentRecord{40a16210 com.google.android.gms broadcastIntent}}
  RTC_WAKEUP #6: Alarm{409f39f0 type 0 com.kuwapp.waleter}
    type=0 when=+23h55m15s943ms repeatInterval=86400000 count=1
    operation=PendingIntent{40abe868: PendingIntentRecord{40be7ab0 com.kuwapp.waleter broadcastIntent}}
  RTC_WAKEUP #5: Alarm{408d3b00 type 0 com.android.providers.calendar}
    type=0 when=+21h39m28s532ms repeatInterval=0 count=0

このように登録されたAlarmが表示されるので確認できます。