Page 1 of 1

How add and use this action?

Posted: 04 Oct 2019 14:27
by sirlaacher
Hi. Just fast question. In exposed i was use action: When i press one from hardware button i can check what activity is on first plan . And really miss that :D. How can i find this in Automagic?

Re: How add and use this action?

Posted: 04 Oct 2019 18:38
by Martin
Hi,

You can use trigger Activity Started to detect activities. You can add an action Notification on Screen: {package_name}/{activity_class} to show the component name.

Regards,
Martin

Re: How add and use this action?

Posted: 04 Oct 2019 19:21
by Desmanto
Alternative method, since you have root, you can use dumpsys command. Martin's solution works. But in case you don't want it to be triggered everytime you open other app and only want it to be trigger manually, dumpsys method will be more suitable. Use trigger Hardware Key event and choose your key. Then add execute root command

Code: Select all

dumpsys window windows | grep -E 'mCurrentFocus'
Then use regex in script to get the package name, app name and the activity.

Code: Select all

find = findAll(stdout, ' mCurrentFocus=Window\\{.* u\\d (.*)/(.*)\\}', true);
pn = find[0][1]; //package name
act = find[0][2];  //activity class
app = getAppName(pn); //app name