1

I usually use OpenVPN Connect android client for connecting to my OpenVPN server in a raspberry. I also use Tasker to automatically connect to the VPN when I am outside from home. My configuration is:

Send Intent
Action:android.intent.action.VIEW
Cat:None
Extra:vpn.AUTOSTART_PROFILE_NAME: <PROFILE NAME>
Package:net.openvpn.openvpn
Class:net.openvpn.openvpn.OpenVPNClient
Target:Activity

Few days ago, the OpenVPN version has been changed to 3.0.1 , and my tasker is not working any more. At least the tasks are not able any more to start a VPN connection or disconnect it.

Obviously, that means that with the new version of the App, some configuration must be changed. Do any body knows what are these new configurations?

1

The offical docs (https://docs.openvpn.net/connecting/connecting-to-access-server-with-android/faq-regarding-openvpn-connect-android/#How_do_I_use_tasker_with_OpenVPN_Connect_for_Android) state:

CONNECT

a) Access Server module Action: net.openvpn.openvpn.CONNECT

OR

Action: android.intent.action.VIEW
Cat: None
Mime Type: {blank}
Data: {blank}
Extra: net.openvpn.openvpn.AUTOSTART_PROFILE_NAME:AS {your_profile_name}
Extra: net.openvpn.openvpn.AUTOCONNECT:true
Extra: net.openvpn.openvpn.APP_SECTION:AS
Package: net.openvpn.openvpn
Class: net.openvpn.unified.MainActivity
Target: Activity

b) OVPN Profile module Action: net.openvpn.openvpn.CONNECT OR

Action: android.intent.action.VIEW
Cat: None
Mime Type: {blank}
Data: {blank}
Extra: net.openvpn.openvpn.AUTOSTART_PROFILE_NAME:PC {your_profile_name}
Extra: net.openvpn.openvpn.AUTOCONNECT:true
Extra: net.openvpn.openvpn.APP_SECTION:PC
Package: net.openvpn.openvpn
Class: net.openvpn.unified.MainActivity
Target: Activity

DISCONNECT

Action: net.openvpn.openvpn.DISCONNECT
Cat: None
Mime Type: {blank}
Data: {blank}
Extra: net.openvpn.openvpn.STOP:true
Extra: {blank}
Extra: {blank}
Package: net.openvpn.openvpn
Class: net.openvpn.unified.MainActivity
Target: Activity

Java code example

String profile = "myvpn";
Intent openVPN = new Intent("android.intent.action.VIEW");
openVPN.setClassName("net.openvpn.openvpn", "net.openvpn.unified.MainActivity");
openVPN.putExtra("net.openvpn.openvpn.AUTOSTART_PROFILE_NAME", "PC "+profile);
openVPN.putExtra("net.openvpn.openvpn.AUTOCONNECT", true);
openVPN.putExtra("net.openvpn.openvpn.APP_SECTION", "PC");
activity.startActivity(openVPN);

The formatting is off but i hope it will help someone

  • I like your answer more than mine. Then I will mark this as the correct one. – King Midas May 24 '18 at 12:48
1

Ok, thanks to this web. Seems that I am right and the configuration has been changed. The new settings for connecting will be:

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

This is able to start the OpenVPN connection using a OVPN file. For disconnection, I also need to change the profile:

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 author comments -and it is true- that when disconnecting the application remains opened on the screen at foreground. A solution proposed on this forum for this issue is to use a not existing profile as a connection. When trying to connect to this non existing profile, the first action will be to disconnect the current one. As the profile does not exists no connection will be performed.

0

https://forum.xda-developers.com/u/tasker-tips-tricks/openvpn-3-0-0-connect-disconnect-tasker-t3750552 Default OpenVPN 3.0.0 - Connect and Disconnect with Tasker (Solution) Hi All,

It would appear that the interface / code changed rather a lot in the most recent update and the previous intents are no longer working.

I have figured out how to fix this. Please follow the directions below.

Important Note: Your profile name is now prefixed with PC. E.g. My profile of test.co.uk/example [user] would now be PC test.co.uk/example [user]

So, here are the settings (don't include the curly brackets):

Connect

Action: net.openvpn.openvpn.CONNECT Extra: net.openvpn.openvpn.AUTOSTART_PROFILE_NAME: PC {Your profile name} Extra: net.openvpn.openvpn.AUTOCONNECT: true Package: net.openvpn.openvpn Class: net.openvpn.unified.MainActivity Target: Activity

Disconnect

Action: net.openvpn.openvpn.DISCONNECT Extra: net.openvpn.openvpn.STOP: true Package: net.openvpn.openvpn Class: net.openvpn.unified.MainActivity Target: Activity

Annoyingly they have made it so OpenVPN remains in the foreground on disconnect. I have yet to look into this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.