ADB Commands
Previous post: PART I
According to documentation:
Android Debug Bridge (adb) is a versatile command-line tool that lets you communicate with a device. The adb command facilitates a variety of device actions, such as installing and debugging apps, and it provides access to a Unix shell that you can use to run a variety of commands on a device.
2) Check if alarms are set and when they are scheduled to trigger
adb shell dumpsys alarm
The command is extremely verbose, I will recommend to filter with grep such as
adb shell dumpsys alarm | grep com.package.name
Tip 1: If you are not going to use grep or something similar use cmd+F or ctrl+F to find your app by searching the package name.
Tip 2: If your terminal's buffer size is not big enough, and you are not using the grep command, it might better to output into a file.
i.e adb shell dumpsys alarm > AlarmsOutput.txt
The output looks like:
Batch{28b15ce num=18 start=60346095 end=65172917 flgs=0x8}:
RTC #17: Alarm{ae74957 type 1 when 1491279601728 com.package.name}
tag=*alarm*:Alarm_Intent
type=1 whenElapsed=+11h57m57s410ms when=2019-04-04 07:20:01
window=+8h59m59s997ms repeatInterval=0 count=0 flags=0x0
operation=PendingIntent{d1cec44: PendingIntentRecord{d3307ba com.package.name broadcastIntent}}
As you can see from above the when= tells us when is set to get triggered.
This is extremely helpful for debugging and verifying AlarmManager's behaviour.
An excellent SO answer on how-to read the output, check it out
Stay tuned for the third part soon!
Top comments (0)