Skip to content

Instantly share code, notes, and snippets.

@SMUsamaShah
Created June 9, 2025 20:12
Show Gist options
  • Save SMUsamaShah/621dce42e1d098bfc10e37f30f7705cd to your computer and use it in GitHub Desktop.
Save SMUsamaShah/621dce42e1d098bfc10e37f30f7705cd to your computer and use it in GitHub Desktop.
Android find total running time of an app today using adb

adb shell dumpsys usagestats can be used to get an app's usage stats.

For example, to get today's run time / usage of YouTube Kids app adb shell dumpsys usagestats com.google.android.youtube.tvkids | grep -A 5 "In-memory daily stats" | grep "totalTimeUsed" | sed 's/.*totalTimeUsed="\([^"]*\)".*/\1/' | awk -F: '{if(NF==2) print "00:" $0; else printf "%02d:%s\n", $1, substr($0, index($0,":")+1)}'

will return run time in HH:MM:SS format 00:00:32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment