Connecting and disconnecting OpenVPN Connect

819 views
Skip to first unread message

gevers

unread,
Mar 3, 2017, 5:11:07 AM3/3/17
to Automate
Hello,

I have tried a lot of things making Automate useful to automatically start OpenVPN Connect when using not my home network. I also don't want to use it when using mobile data.
I will write down below what I would like. If you can help, don't hesitate :-)

To Start OpenVPN Connect:

IF connect to Wifi network NOT being my home SSID THEN
LAUNCH Intent:
  Action: android.intent.action.VIEW
  Package: net.openvpn.openvpn
  Class: net.openvpn.openvpn.OpenVPNClient
  Extra name: net.openvpn.openvpn.AUTOSTART_PROFILE_NAME
  Extra parameter: "Name of my OpenVPN Connect Profile"

To Disconnect OpenVPN Connect:

IF disconnect from a Wifi network THEN
LAUNCH Intent:
  Action: android.intent.action.VIEW
  Package: net.openvpn.openvpn
  Class: net.openvpn.openvpn.OpenVPNDisconnect


Henrik "The Developer" Lindqvist

unread,
Mar 3, 2017, 3:15:47 PM3/3/17
to automa...@googlegroups.com, g.vers...@gmail.com
  1. http://llamalab.com/automate/doc/block/wifi_connected.html
  2. http://llamalab.com/automate/doc/block/activity_start.html
    Action, Package and Class as you'd expect, Extras: { "net.openvpn.openvpn.AUTOSTART_PROFILE_NAME": "Name of my OpenVPN Connect Profile" }

g.vers...@gmail.com

unread,
Mar 4, 2017, 4:20:11 AM3/4/17
to Automate, g.vers...@gmail.com
Thanks a lot. It works.

I have made a flowchart that automatically connects to OpenVPN Connect when I am using a Wi-Fi network not being my Home SSID. If I disconnect from a Wi-Fi network is disconnects my OpenVPN connection. Just what I want.

One "problem" is still remaining. Can I do the connecting and also the disconnecting at the background -> I don't want to see the application start, because it stays open. Also when I disconnect it stays open.

If I have solved this, I will upload the flowchart.

Thanks!!!


Op vrijdag 3 maart 2017 21:15:47 UTC+1 schreef Henrik "The Developer" Lindqvist:

Henrik "The Developer" Lindqvist

unread,
Mar 4, 2017, 2:30:35 PM3/4/17
to Automate, g.vers...@gmail.com
It's not really possible to start an app in the background. Try using the Interact block with action Back or Home after the App start block

nick.em...@gmail.com

unread,
Oct 14, 2019, 6:56:06 AM10/14/19
to Automate
Hi Henrik,
Is it still impossible to start OpenVPN connection in the background without root access?
Thanks in advance.

суббота, 4 марта 2017 г., 22:30:35 UTC+3 пользователь Henrik "The Developer" Lindqvist написал:

Henrik "The Developer" Lindqvist

unread,
Oct 14, 2019, 5:57:07 PM10/14/19
to Automate
Try asking the OpenVPN developers, if their app has a Service other apps can start, i.e. using the Service start block.
An Activity, i.e. as started by the App start block, is a front end, so it's never meant to be started in the "background".

nick.em...@gmail.com

unread,
Oct 15, 2019, 2:59:43 AM10/15/19
to Automate
Yes, it has. I have checked already all OpenVPN service settings:
Service start block:
Package: de.blinkt.openvpn
Action: android.intent.action.VIEW
Extras: {"net.openvpn.openvpn.AUTOSTART_PROFILE_NAME": "my_profile_name"}

  1. Service class: de.blinkt.openvpn.core.OpenVPNService
    Fail: java.lang.SecurityException: Not allowed to start service intent {act=android.intent.action.VIEW cmp=de.blinkt.openvpn/.core.OpenVPNService (has extras)} without permission android.permission.BIND_VPN_SERVICE

  2. Service class: de.blinkt.openvpn.OpenVPNTileService
    Fail: java.lang.SecurityException: Not allowed to start service intent {act=android.intent.action.VIEW cmp=de.blinkt.openvpn/.OpenVPNTileService (has extras)} without permission android.permission.BIND_QUICK_SETTINGS_TILE

  3. Service class: de.blinkt.openvpn.api.ExternalOpenVPNService
    Info: Service started
    Working only if OpenVPN app already started in background, but no connection occurred. So, maybe it is possible to use other action and extras with this?

  4. Service class: de.blinkt.openvpn.core.OpenVPNStatusService
    Fail: java.lang.SecurityException: Not allowed to start service intent {act=android.intent.action.VIEW cmp=de.blinkt.openvpn/.core.OpenVPNStatusService (has extras)} without permission not exported from uid 10372


вторник, 15 октября 2019 г., 0:57:07 UTC+3 пользователь Henrik "The Developer" Lindqvist написал:

Henrik "The Developer" Lindqvist

unread,
Oct 17, 2019, 12:00:25 AM10/17/19
to Automate
The de.blinkt.openvpn.api.ExternalOpenVPNService sound promising, the other services aren't public for other apps to use.
But, as said, i don't know, you have to ask the OpenVPN developers.
Reply all
Reply to author
Forward
0 new messages