Can Tasker minimize apps to backgound?

3,679 views
Skip to first unread message

David Peterson

unread,
Jul 30, 2016, 12:38:19 PM7/30/16
to Tasker
Hi!

I want to know how to use Tasker to either start an APP minimized to background or use Tasker to minimize an APP after it's been opened.

Can someone tell me how to do this?

Brad Minion

unread,
Jul 30, 2016, 2:34:06 PM7/30/16
to Tasker
You can try using the "Go Home" action.

Hippo Man

unread,
Nov 1, 2016, 11:27:31 AM11/1/16
to Tasker
You can try using the "Go Home" action.

Yes, but is there a way to cause the previous foreground app to reappear?

In other words ...

1. App ABC is currently in the foreground.
2. Tasker context causes a task to fire off. This Tasker task launches app XYZ.
3. Tasker task somehow causes app XYZ to go into the background and reinstates app ABC into the foreground. This should work no matter what app was previously in the foreground. It could be app ABC or app QWERTY or any other app that might have previously been showing.

Is there a way to perform steps 2 and 3 in Tasker?
.

Hippo Man

unread,
Nov 1, 2016, 8:51:34 PM11/1/16
to Tasker
I figured out how to do this.

I wrote a task to run the following command via "Run Shell" (assumes busybox has installed links to all its apps in /system/xbin) ...


/system/bin/dumpsys activity activities | /system/xbin/egrep mFocusedActivity | /system/xbin/tail -1 | /system/xbin/awk '{ print $4 }'

Its output is the id for the activity which is currently visible in the foreground. I store this in a variable called %curractivity

I then invoke "Launch App" to launch each app that I want to put into the background.

After this, I invoke "Go Home". This makes sure that all those launched apps go into the background.

Then, I invoke the following command via "Run Shell". This brings the originally visible activity back to the foreground.

/system/bin/am start -n %curractivity

There are some edge cases that need to be dealt with, but that's the general procedure.
.



Reply all
Reply to author
Forward
0 new messages