Wednesday 27 July 2016

[Question] How to use Tasker to connect and disconnect VPN with "OpenVPN for Android"



Hi folks,

in the past I used "OpenVPN Connect" to connect to my home network.
I found a guide how I can connect and disconnect the VPN automatically with a Tasker task (e.g. when I'm connected to a unknown wifi).

Now I switched to "OpenVPN for Android" for different reasons. I searched in the Internet for a similar soultion for Tasker, but I didn't found one.
I've managed to set up a task by myself to connect the VPN. But disconnecting doesn't work. aLogcat says "Denied" when I try to call the DisconnectVPN function/class.

I know that there's a app called "OpenVpn Tasker Plugin" which can do this for me. But I'm not a friend of "Apps-for-every-little-task". It would like to solve thiss with the Tasker actions itself.

Here are my tasks:

Connect VPN (works!)
Send Intent
Action:android.intent.action.MAIN
Cat:None
Extra:de.blinkt.openvpn.shortcutProfileName:PROFIL ENAME
Package:de.blinkt.openvpn
Class:de.blinkt.openvpn.LaunchVPN
Target:Activity

Disconnect VPN (doesn't work)
Send Intent
Action:android.intent.action.MAIN
Cat:None
Extra:de.blinkt.openvpn.shortcutProfileName:PROFIL ENAME
Package:de.blinkt.openvpn
Class:de.blinkt.openvpn.activities.DisconnectVPN
Target:Activity


The kill action to disconnect the VPN works, but the app restarts the VPN connection itself a few seconds later.

Has anyone an idea how to solve this?

Thank you!
Jas Man



No comments:

Post a Comment