The latest release of Tailscale for Android comes with 2 cool intents making it possible to use Tasker to create automations to turn on/off the VPN.
To configure an automation, in Tasker:
add a new task, let’s call it “Taiscale connect”
in the task, add a “Send intent” action, you can use the search bar to bring it up
fill in the following fields and leave the rest as default:
Action: com.tailscale.ipn.CONNECT_VPN
Package: com.tailscale.ipn
Class: com.tailscale.ipn.IPNReceiver
To configure the disconnect task, do the same and replace CONNECT_VPN by DISCONNECT_VPN.
Now that the tasks are configured, you can go on and configure your profiles which define the automations. For example, I configured a profile to automatically turn off the VPN when my phone connects to my home wifi:
create a new profile and select “State”
search “Wifi connected” and select it
fill in the “SSID” field with the name of you wifi
go back and link it to the task we created earlier
You can also configure it to automatically turn on the VPN when you disconnect from the wifi by doing the same and checking the “Invert” checkbox when creating the profile.
Anyone trying the tutorial, enter the Target: Broadcast Receiver field only otherwise it won’t work.
Also, for anyone trying to avoid Send Intents, you need to have access to ADB Wifi and you can toggle the Tailscale QuickSettings Tile. You might also require to check that the Tailscale QS Tile is available.
The task description for comparing your configuration:
Note: The part <inside> are comments and there might be some bugs in Tailscale which can possibly fail the task; Reference.
Thanks for this, I just downloaded Tasker to turn Tailscale on and off depending on my home WiFi. Searched “tasker” in here and found your post. Working great on Android 15 . I did try with just launching/killing the app but I needed adb enabled or something, this is much better.
If you manually run the app, connect and then make sure you’ve picked an exit node, it will keep that exit node setting even if you disconnect, exit the app, etc, and then reconnect afterwards (I just confirmed this with the latest Android app as of this post).
I really appreciate your post. Please don’t think I wanted to correct you and rather wanted to help a needy wondering where they had done it wrong along with a different way of doing the same. Care to crosspost/repost in r/Tasker? I think people may find it helpful.