英文:
How to get Activity Waiting Time from ActivityManager on app launching?
问题
我使用ADB来在启动应用程序时显示等待时间活动,我使用的命令是:adb shell am start -S -W com.example.app/.MainActicity -c android.intent.category.LAUNCHER -a android.intent.action.MAIN
这是结果:
所以,我的问题是如何以编程方式获取waitTime
的值?谢谢。
英文:
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 :
So, my question is how to get programmatically the waitTime
value ? thanks.
答案1
得分: 1
根据评论部分的建议,在拥有基于Linux的终端时,您可以通过解析am start
命令的输出并过滤值来以编程方式检索WaitTime,如下所示:
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
其中,grep -i waittime
过滤包含 waittime 的行,而 cut
命令检索值本身。
希望这有所帮助。
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论