Get the list of running apps in background

1,197 views
Skip to first unread message

naboleo

unread,
Sep 20, 2011, 4:05:56 PM9/20/11
to Tasker
Hello,

I was thinking of improving my "car mode" profile. It's working fine
for GPS and bluetooth with the %IUMODE variable trigger.
The exit task, is fine also for disabling these sensor. But I'd like
to have a way to kill potential tasks too.
Problem is that kill function isn't working for backgrounded tasks,
but i did a quick test and it's fine when tasks are in foreground.
I was thinking of launching these apps again one by one to, just to be
sure it's on foreground and then kill them. That is quite simple, I
just have to run the app again and it pops up.
The annoying part is that if the potential apps isn't really running
(not even in background) then it's start and that is time/cpu
consuming.
So is the a way to detect the apps process on the background ? Having
a list of them so I could check if I need to kill it or not.

Any idea ?

Pent

unread,
Sep 20, 2011, 4:50:25 PM9/20/11
to Tasker
> Problem is that kill function isn't working for backgrounded tasks,

Should do, if they are actually running at the time and part of the
same process as the UI (which is usual).

> So is the a way to detect the apps process on the background ?  Having
> a list of them so I could check if I need to kill it or not.

There is no way currently.

Pent

nanobrain

unread,
Sep 20, 2011, 11:42:11 PM9/20/11
to tas...@googlegroups.com
No way? How about using Secure Settings and get the output of  "pgrep -l com.*" into Tasker which should give you a list of running processes and then do some matching magic. 

Just an idea. 

naboleo

unread,
Sep 21, 2011, 1:52:53 AM9/21/11
to Tasker




On 20 sep, 22:50, Pent <supp...@apps.dinglisch.net> wrote:
> > Problem is that kill function isn't working for backgrounded tasks,
>
> Should do, if they are actually running at the time and part of the
> same process as the UI (which is usual).

3 of the apps i need to kill are using a notification process (or
service?) so the kill function isn't Just restarting the process and
not really ending the tasker.
I do love the idea but is there a way to redirect the output into a
variable or do i need to use the stdout with redirection to a file,
then open, parse and so on?

Regards

naboleo

unread,
Sep 21, 2011, 2:52:06 AM9/21/11
to Tasker
I do hate this auto correction feature from android.
Anyway here is a better sentence

kill function is just restarting the process and not really ending the
apps.

Sorry

BossMan

unread,
Sep 21, 2011, 3:20:46 AM9/21/11
to tas...@googlegroups.com

I do love the idea but is there a way to redirect the output into a
variable or do i need to use the stdout with redirection to a file,
then open, parse and so on?

Use that plugin mentioned earlier:
https://market.android.com/details?id=com.intangibleobject.securesettings.plugin
"• Run Command
  º Execute any linux command with the ability to capture all the information from the output, error streams as well as the exit value of the command!"

BR,
A.

naboleo

unread,
Sep 21, 2011, 4:56:57 PM9/21/11
to Tasker
Did install Secure Setting and that a really cool plugin ! Thanks for
pointing it to me, it will be very usefull.
So I played a bit with it and discover I have been too quick running
my previous test as killing apps isn't working !!!!
These notification and service mechanism is very efficient and killing
the pid is just closing the GUI. Notifications are permanent and
selecting them is restarting the app.
That's a very similar behaviour to the one when tasker's kill feature.

I'm stuck....

Any idea ?

Matthieu Berthomé

unread,
Sep 22, 2011, 4:51:52 AM9/22/11
to tas...@googlegroups.com
what can happen with notifications is this :
The app create the notification, with a pending intent that is a broadcast.
Android works by having app register what intents they can receive, link it to an activity (an app GUI)

Therefore you can have
-an app register a pending intent in a notification
-This app being crushed with a hammer, eviscerated, left to rot, for sure, there's no more processes running
-But once the notification is tapped, the pending intent is launched, Android is very happy to launch the app again ;-)
basically it's an android native way of letting app go to sleep, be killed, while still keeping their functionalities (sms apps can be called when the broadcasted intent is of a new sms, etc etc). This is the root of the energy efficiency for Android.
I think that's your issue with the notifications restarting a previously killed app.
I'd let the notification there after killing the app, there's basically no more cpu/ram usage for this app, the notification that is left might be ugly but I don't see a way to remove it as is.
Matthieu

Reply all
Reply to author
Forward
0 new messages