How to get Activity Waiting Time from ActivityManager on app launching?

620 Views Asked by At

I'm using ADB to show Waiting Time Activity on launching app, the command I used is : adb shell am start -S -W com.example.app/.MainActicity -c android.intent.category.LAUNCHER -a android.intent.action.MAIN here's the result :

RESULT

So, my question is how to get programmatically the waitTime value ? thanks.

1

There are 1 best solutions below

0
Lino On BEST ANSWER

As suggested in the comments sections, having a Linux-based terminal you can retrieve the WaitTime programmatically by parsing the output of the the am start command and filtering the value like this:

adb shell am start -S -W "com.example.abder.emarque/.Activities.EMarque" -c android.intent.category.LAUNCHER 
-a android.intent.action.MAIN | grep -i waittime | cut -d' ' -f2

3813

whereas grep -i waittime filters the line containing the waittime and the cut command retrieves the value itself.

Hope this helps.