Instantly share code, notes, and snippets.

Embed
What would you like to do?
A shell script log the current android top activity
oldActvity=""
displayName=""
currentActivity=`adb shell dumpsys window windows | grep -E 'mCurrentFocus'`
while true
do
if [[ $oldActvity != $currentActivity && $currentActivity != *"=null"* ]]; then
displayName=${currentActivity##* }
displayName=${displayName%%\}*}
echo $displayName
oldActvity=$currentActivity
fi
currentActivity=`adb shell dumpsys window windows | grep -E 'mCurrentFocus'`
done
@bonebizz21

This comment has been minimized.

Show comment
Hide comment
@bonebizz21

bonebizz21 Oct 3, 2018

content://media/external/file/113141

bonebizz21 commented Oct 3, 2018

content://media/external/file/113141

@bonebizz21

This comment has been minimized.

Show comment
Hide comment
@bonebizz21

bonebizz21 Oct 3, 2018

content://media/external/file/113141

bonebizz21 commented Oct 3, 2018

content://media/external/file/113141

@bonebizz21

This comment has been minimized.

Show comment
Hide comment
@bonebizz21

bonebizz21 Oct 3, 2018

content://media/external/file/113141

bonebizz21 commented Oct 3, 2018

content://media/external/file/113141

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