How to tell if an app has been closed completely

General discussions about Automagic and automation in general

Moderator: Martin

Post Reply
jkcaldwe
Posts: 4
Joined: 19 Aug 2013 19:34

How to tell if an app has been closed completely

Post by jkcaldwe » 28 Aug 2013 17:44

I am trying to figure out if there is a way to trigger an action when an app has been closed completely using the task manager.

Here is what I am trying to do: I have my GPS automatically come on when the google maps app is opened. I want it to stay on until the app is closed in the task manager, not closing while it is running in the background. If I am using maps and receive a text or call and maps is sent to the background I want to keep the GPS running so when I switch back it will still be on. When I close it completely in the task manager then GPS will turn off.

Right now I am using the app ended trigger but it triggers even when the app is sent to the background and then will not trigger again if i just close it from the background. Is there any way to tell if an app has been completely closed as opposed to just sent to the background?

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: How to tell if an app has been closed completely

Post by Martin » 09 Sep 2013 17:26

Hi,

There is no built-in trigger available to detect when Android terminates a process. Android can also keep the process alive when enough memory is available but the app is not used at all (shows up in cached processes).
You could use a condition App Process Running to periodically check if the maps process is still running but I would not recommend to do this very frequently since it will wake the device whenever the flow executes. This is probably not an issue when you use the flow only when the screen is turned on.

Regards,
Martin

standalonescript
Posts: 18
Joined: 13 Sep 2013 03:11

Re: How to tell if an app has been closed completely

Post by standalonescript » 13 Sep 2013 05:46

If you never actually turn your screen off when using maps, answering calls, texts, etc. You could set GPS to turn off with the screen. You would just need to foreground maps to enable it again.

Josh

Post Reply