Turning VPNs on/off without hassle

Share and discuss your flows and ideas with other users.

Moderator: Martin

gyst
Posts: 12
Joined: 01 Feb 2015 12:17

Turning VPNs on/off without hassle

Post by gyst » 04 Aug 2017 13:32

I just made a flow for connecting/disconnecting my VPNs by shortcut if I want to.

Download

Version History:
----------------
25 Mar 2019
27 Mar 2018
23 Sep 2017
16 Aug 2017
04 Aug 2017
----------------

Brief explanation of the flow:
  • Triggered by a Shortcut (trigger can be changed to whatever you like),
  • checks for Automagic Accessibility service,
  • launches VPN settings,
  • get a list of the VPN connections,
  • check if there is a connection already, if yes: disconnect, if no: popup single choice menu for selecting VPN,
  • close VPN settings.
I have no idea if it's going to work out if your Android is below Nougat (7). But you can post your version of Android and let other's know if it's okay.

In case you don't use English as the main system (UI) language you need to adapt some strings in the Expression-condition (Connected) and the Control UI-actions (Connected, Connecting, Unsuccessful, Cancel, Disconnect, VPN is connected).
Last edited by gyst on 01 Jan 2020 16:20, edited 4 times in total.

gyst
Posts: 12
Joined: 01 Feb 2015 12:17

Re: Turning VPNs on/off without hassle

Post by gyst » 16 Aug 2017 15:39

There is an updated version, which should support German as well (and names/vars and stuff are cleaned up a bit).
Additional languages are possible now if you like, but you need to adapt/extend the DirectVPN Expression: syslang/translations in that case.
Btw, that's the only thing which should be adapted/changed if necessary.

Another brief explanation of the updated flow:
  • Triggered by a Shortcut (trigger can be changed to whatever you like),
  • checks system language, if language is not supported, output dialog,
  • checks for Automagic Accessibility service, if not running, output dialog and launch accessibility settings,
  • launches VPN settings,
  • get a list of the VPN connections,
  • check if there is a connection already, if yes: disconnect, if no: popup single choice menu for selecting VPN,
  • close VPN settings.
Download here

gyst
Posts: 12
Joined: 01 Feb 2015 12:17

Re: Turning VPNs on/off without hassle

Post by gyst » 23 Sep 2017 16:32

Another update, this time with a smaller code footprint for additional languages (in DirectVPN Expression: syslang/translations).

Download

SGET
Posts: 3
Joined: 10 Nov 2017 21:15

Re: Turning VPNs on/off without hassle

Post by SGET » 16 Dec 2017 07:11

Hello,

this is a really nice flow. I want to use it to set the ip via the settings. Do you know, how I get the value for the click command, so that I not click the vpn name itself?

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Turning VPNs on/off without hassle

Post by Desmanto » 16 Dec 2017 09:29

You can use Control UI - Show Overlay and navigate to the place where the IP setting is. The layout is different in each phone, so you have to tried it out by yourself.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

morpheus999
Posts: 6
Joined: 12 Jan 2018 08:53

Re: Turning VPNs on/off without hassle

Post by morpheus999 » 20 Mar 2018 17:14

Hi.

I have only one VPN Connection. I don´t have to choose a VPN Profile. What i have to change in the flow, to connect my VPN automatic ?

Sorry for my bad english.

Georg

morpheus999
Posts: 6
Joined: 12 Jan 2018 08:53

Re: Turning VPNs on/off without hassle

Post by morpheus999 » 23 Mar 2018 10:24

Hi.

Can i change the code, so i have to edit some code to input my VPN Name ?
The popup menu can be deleted ?

gyst
Posts: 12
Joined: 01 Feb 2015 12:17

Re: Turning VPNs on/off without hassle

Post by gyst » 26 Mar 2018 09:10

Hi morpheus999, you don't need to change anything actually. Just get the latest version which I already posted in September. I added a condition in order to check if there are multiple VPNs listed and if not skip the dialog.

morpheus999
Posts: 6
Joined: 12 Jan 2018 08:53

Re: Turning VPNs on/off without hassle

Post by morpheus999 » 27 Mar 2018 12:06

ok, then it doesnt work for me, because it askes every time to choose aa VPN Connection. But i have only one.

But i dont see a "condition" to choose if there are more then one...

gyst
Posts: 12
Joined: 01 Feb 2015 12:17

Re: Turning VPNs on/off without hassle

Post by gyst » 27 Mar 2018 14:11

Oops, sorry, my bad.
Apparently I haven't released the version with the last changes.

Here is my latest version.

Post Reply