I am giving dumpsys window windows | grep -E 'mCurrentFocus | mFocusedApp'
command in the command prompt and it is not giving any results.enter image description here
Asked
Active
Viewed 4,318 times
0

Alex P.
- 30,437
- 17
- 118
- 169

chandu2798
- 3
- 1
- 3
-
Make sure ADB is setup properly. Please make sure too that you open the app before use command, because command would provide the details only for the app which is currently in focus. Try this without Pipe ..... dumpsys window windows | grep -E ‘mCurrentFocus’ – Muzzamil Dec 19 '19 at 10:05
-
you should have copied the command verbatim https://stackoverflow.com/a/13212310/1778421 – Alex P. Dec 19 '19 at 22:47
-
also please do not post text as images – Alex P. Dec 19 '19 at 22:48
-
remove space character between 'mCurrentFocus' and '|' and 'mFocusedApp'. you must use 'mCurrentFocus|mFocusedApp' instead of 'mCurrentFocus | mFocusedApp' – Suban Dhyako Dec 20 '19 at 05:29
4 Answers
3
On my Android 11 device, using dumpsys window windows
doesn't give the currently focused window. Instead one has to do:
dumpsys window displays | grep -E 'mCurrentFocus|mFocusedApp'
I think a solution that works on all devices is:
dumpsys window | grep -E 'mCurrentFocus|mFocusedApp'
(dumpsys window
dumps information about all the subtopics, including windows and displays).

Alexander Pruss
- 365
- 3
- 10
2
Remove the extra spaces:
dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp'

Alex P.
- 30,437
- 17
- 118
- 169
0
Use this code.
dumpsys window | grep -E 'mCurrentFocus|mFocusedApp'

Ankit Sharma
- 1
- 1
-
As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Feb 14 '22 at 18:09
0
For windows you can easily find out app package and app activity below this command: open cmd in your PC
- adb devices
- adb shell dumpsys window | find "mCurrentFocus"

Al Amin
- 1
- 1