2010年1月24日 星期日

關於AlarmManager之二三事 (3)

怎樣查看一個alarm有沒正確的跟Alarm manager註冊了呢?

這時候就是請出bugreport的時候了:

adb bugreport > bugreport.txt

打開bugreport.txt後搜尋"DUMP OF SERVICE alarm", 你就會發現下面的資訊, 這就是你需要的了:

Current Alarm Manager state:

Realtime wakeup (now=1264350748706):
RTC #1: Alarm{43c639e8 type 1 android}
type=1 when=1264435200000 repeatInterval=0 count=0 operation=PendingIntent{43bb7510: PendingIntentRecord{43bf57a0 android broadcastIntent}} RTC #0: Alarm{43dad548 type 1 android}
type=1 when=1264350780000 repeatInterval=0 count=0 operation=PendingIntent{43b9fc48: PendingIntentRecord{43c13278 android broadcastIntent}}

Elapsed realtime wakeup (now=1979294):
ELAPSED_WAKEUP #0: Alarm{43d33930 type 2 android}
type=2 when=70664306 repeatInterval=0 count=0 operation=PendingIntent{43bb39e8: PendingIntentRecord{43b80d90 android broadcastIntent}}