How to alternate/switch apps ?

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
ltplenus
Posts: 23
Joined: 10 Jan 2015 21:39

How to alternate/switch apps ?

Post by ltplenus » 26 Nov 2016 15:55

Here's is my scenario.
I have youtube and maps opened/running... I'm using proximity sensor as the trigger and a dialog box to allow me to select the application I want to bring to front. So..how to do it/switch them automatically without any manual input ?
I know some conditions and expressions must be used but I don't really know how.

Thanks !

P-chu
Posts: 32
Joined: 05 Nov 2016 19:12

Re: How to alternate/switch apps ?

Post by P-chu » 26 Nov 2016 23:58

Hi itplenus,

First thing that comes to my mind to suggest would be to use a global variable to indicate which app you are currently using. The variable name needs to start with "global_", so you could call it "global_runningapp" for example. Then you could use the action "Script" to set and update the global variable, and the condition "Expression" to check which state/value the variable is at. Also, when you start your two apps, you will want to set the initial value to the global variable (or reset the initial value when you stop your proximity flow).

A little more complex (maybe) is to use one or two condition "App Task Running"s to see if one of your two apps is running in the foreground. Mind you, I've been getting the impression that this condition box may not work with everyone. Anyway, the obvious follow-up is to launch (even if already in background) or bring to foreground the other app. If the first "App Task Running" had been false, then you could either assume that the other app is in the foreground (and follow-up accordingly), or do a check on the other app.

Hope these suggestions are usable for you.
P-chu

User avatar
ltplenus
Posts: 23
Joined: 10 Jan 2015 21:39

Re: How to alternate/switch apps ?

Post by ltplenus » 28 Nov 2016 00:27

Thanks a lot P-chu !

Would it be too much to ask for you to post a flow ?

P-chu
Posts: 32
Joined: 05 Nov 2016 19:12

Re: How to alternate/switch apps ?

Post by P-chu » 01 Dec 2016 00:09

Well, ltplenus, this should not be too difficult for you to make if you already have created a flow with a dialog box. However, you first need to determined how you want your device/phone to know when to switch app and to which app if it is important for certain situations. If not dialog box, then a widget on the home page? A floating (aka "overlay") widget or button? A fixed notification in the statusbar? Orientation or shaking of phone (though it may not be reliably responsive enough)? What is the "why" and "when" you want to switch apps?
P-chu

Post Reply