I have several flows with control UI (love it!) where the flow needs the app to be into its main or home page to work. If I try to kill the app and realunch it many times it doesn't work (it doesn't quit, even when in background).
Is there any other way to make sure an app is in its main page when activated, as when launched for the first time?
Thank you.
how to ensure you get to the home or main screen of an app
Moderator: Martin
- tsolignani
- Posts: 187
- Joined: 12 Jan 2019 11:53
- Location: Vignola, Mo, Italy
- Contact:
Re: how to ensure you get to the home or main screen of an app
How about adding back() several times to ensure it always back-ed until the main page of the app. This varies depends on the app. You can add additional check for certain element in the app before executing the main script. Example if the app is now in level 2, you can use back(); sleep(100); back(), to back twice to the main screen. Check for any element Id that might be there using existsElementById(), choose the element that only appear at the sub menu level 2. Do the same also for other sub menu.
Or you can make universal back() if there is certain element that only exists in main screen. So the script will loop back() if this element is not exists. Example for Gmail, the search box is always in the main screen.
This ensure it will press back() until it back to main screen. I add check for loop is less than equal to 5. This protect so the back is only pressed maximum 5 times, in case you mis-run the script not inside Gmail.
Or you can make universal back() if there is certain element that only exists in main screen. So the script will loop back() if this element is not exists. Example for Gmail, the search box is always in the main screen.
Code: Select all
loop = 0;
if(!existsElementById("com.google.android.gm:id/open_search") AND loop <= 5)
{
back();
loop = loop + 1;
sleep(100);
}
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
- tsolignani
- Posts: 187
- Joined: 12 Jan 2019 11:53
- Location: Vignola, Mo, Italy
- Contact:
Re: how to ensure you get to the home or main screen of an app
Just great! Thank you so much. I am not only fixing my flows, but learning many things.
Have a nice day.
Have a nice day.
- tsolignani
- Posts: 187
- Joined: 12 Jan 2019 11:53
- Location: Vignola, Mo, Italy
- Contact:
Re: how to ensure you get to the home or main screen of an app
It does work! Wonderful. Thanks again.