Skip to main content

Get Foreground Activity

inside a .bat file:

@adb shell "dumpsys activity activities | grep ResumedActivity"
@adb shell "dumpsys activity | grep mCurrentFocus"
@adb shell "dumpsys activity top | grep 'ACTIVITY' | tail -n 1"