Simulating Force stop of an app with tasker

7,956 views
Skip to first unread message

Tejas Karandikar

unread,
Mar 6, 2012, 6:28:58 PM3/6/12
to Tasker
When you go to Settings->Apps->Running and select force stop on an app
like Whatsapp with background services, the app is killed properply
along with its background services...

The same does not happen with Kill app (using root) with Tasker....The
service immediately restarts itself......I want to "force stop"
Whatsapp when connected to my work wifi network, as it doesn't work
here and ends up using a lot of wakelocks....

Is there any way of doing this with Tasker ?

Pent

unread,
Mar 7, 2012, 4:24:08 AM3/7/12
to Tasker
> Is there any way of doing this with Tasker ?

The closest you can get is with Use Root (obviously you need a rooted
phone).

Unfortunately, Tasker doesn't have access to the same abilities as the
builtin settings app.

Pent

Aleš Berka

unread,
Feb 11, 2013, 6:39:32 AM2/11/13
to tas...@googlegroups.com
I have done something similar in Tasker. To stop it, you need to freeze it using root shell command "pm disable". If you want the application to be available after this, execute "pm enable" quickly after. It won't start the service again.
You can start the application from the launcher (and if the application = Whatsapp is coded properly, it will start the background service) or use "am broadcast" command to simulate BOOT_COMPLETED event(intent) which is responsible for starting the application after reboot.

Dave Fisher

unread,
Feb 11, 2013, 6:49:44 AM2/11/13
to tas...@googlegroups.com
You can just do:

am force-stop packagename

eg.

am force-stop com.google.android.apps.maps

via run shell, to force stop something. I use it to force stop maps :)


On 11 February 2013 11:39, Aleš Berka <ales.b...@gmail.com> wrote:
I have done something similar in Tasker. To stop it, you need to freeze it using root shell command "pm disable". If you want the application to be available after this, execute "pm enable" quickly after. It won't start the service again.
You can start the application from the launcher (and if the application = Whatsapp is coded properly, it will start the background service) or use "am broadcast" command to simulate BOOT_COMPLETED event(intent) which is responsible for starting the application after reboot.

--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Aleš Berka

unread,
Feb 11, 2013, 6:59:09 AM2/11/13
to tas...@googlegroups.com
But if the application is running a service (might be even a service without ongoing notification), the service will be automatically restarted after a short while. Unless I'm mistaken. "pm disable" and "pm enable" approach stops it without relaunching it.

Dave Fisher

unread,
Feb 11, 2013, 7:05:31 AM2/11/13
to tas...@googlegroups.com
That was the problem I had with maps. Using kill, or pkill both resulted in it being respawned a few minutes later. Using force-stop, if does not respawn. It maybe specific to the app/service you are trying to kill, but its worth trying/bearing in mind.

J.

unread,
Feb 11, 2013, 11:51:06 AM2/11/13
to tas...@googlegroups.com, mob...@the-darkside.co.uk
One option is to use Task Kill app - it's a tasker plugin from the market, and in those cases where nothing else worked for me scripting-wise, Task Kill worked every time.

Aleš Berka

unread,
Apr 8, 2013, 5:45:51 PM4/8/13
to tas...@googlegroups.com
Also "pm disable" and "pm enable" (immediately after) works well, kills the application and does not let it respawn automatically (esp. important for services)
Reply all
Reply to author
Forward
0 new messages