Monitor Android App's Alarm Functionality through Terminal

Sometimes you may wonder why your alarm is not triggering and you may also had a doubt that whether your alarm is cancelled or not. Here is the way to check your alarm existence and how to check the timings.

All you need to know about testing your alarm are package name of the application that you want to test and Terminal(in linux) or Terminal in Android Studio(any platform).

Note: Your mobile should be connected to PC via USB and debug mode should be enabled.

Open your Terminal or Android Studio's Terminal and type the below command:

adb shell dumpsys alarm 

This will list all the alarm's already triggered in your mobile. To see the alarm's set by particular app:

adb shell dumpsys alarm | grep yourpackagename

This will give you the alarm log for a particular app.

Next we will see how to understand the components in the log and there by alarm existence. The typical log is showed below:
RTC_WAKEUP:  Gives the type of alarm.

#0: Represents number (count) of alarms (in the whole android ) been batched at that time.

4945ab6: Unique id given to that particular alarm

type 0: Represents type of alarm in one of {RTC_WAKEUP, RTC, ELAPSED_WAKEUP, 
ELAPSED}

0000000000: Time in milliseconds at which the next alarm will be triggered.

com.example.package: Package name to which application alarm belongs.

tag: Represents the component which will invoke at the time of alarm.

operation: Reference to the pending intent that gets triggered the alarm.

In the second log you can see the few more lines of details. Those extra lines shows the details of alarms that has been already triggered. Next we will discuss about that:

u0a242: Id of the alarm.

packagename: application package

+40ms: Time taken to complete the action

1 wakeups: no of times alarm is triggered for that application

Note: If you found any extra info in the log let me know through comments

Comments

Popular posts from this blog

Horizontal FlatList inside sectionList

Package Name vs Application Id (Android)