Turning VPNs on/off without hassle

Share and discuss your flows and ideas with other users.

Moderator: Martin

dragon
Posts: 29
Joined: 10 Sep 2015 08:13

Re: Turning VPNs on/off without hassle

Post by dragon » 05 Jul 2018 02:30

I use PureVPN. I am going to save some VPN connections manually within Android. These connections connect to various servers in various cities. I'd like to have automagic determine what city I currently am in, and then use the saved VPN connection that connects to the server of the city I am currently in. Can this flow be modified to do that?

User avatar
digitalstone
Posts: 338
Joined: 21 Oct 2017 12:36
Location: The Netherlands

Re: Turning VPNs on/off without hassle

Post by digitalstone » 05 Jul 2018 07:24

I haven't delved into your flow that thoroughly. Nice work btw.
But can't you save your location into a glovar and implement that inside a piece of existing code-part of the flow?
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)

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

Re: Turning VPNs on/off without hassle

Post by gyst » 09 Jul 2018 13:17

digitalstone wrote:I haven't delved into your flow that thoroughly. Nice work btw.
But can't you save your location into a glovar and implement that inside a piece of existing code-part of the flow?
You could adjust the last line from the syslang/translations expression (condition) by replacing

Code: Select all

matches(trim(syslang), check);
with something like this:

Code: Select all

matches(trim(syslang), check) && location;
In this case location as global variable (boolean).

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

Re: Turning VPNs on/off without hassle

Post by gyst » 09 Jul 2018 13:31

morpheus999 wrote:Hi.

Now it dont work because of Android 8.0 API26...
Sorry, but I still don't have an Oreo device, hence no ability to customize it at the moment.
Oreo users would have to either "debug" it themselves (and preferably share it) or wait until I also have the time to use a newer version.

han@sytsma.co.uk
Posts: 1
Joined: 29 Aug 2018 11:22

Re: Turning VPNs on/off without hassle

Post by han@sytsma.co.uk » 30 Aug 2018 18:59

For checking if the VPN service is running in Oreo, you can use the ping condition.
Since a VPN is based on a point-to-point connection, you could use a ping to determine if an endpoint is up.
For instance in OpenVPN the server can be at 10.8.0.1, your phone will probably get an IP address between 10.8.0.2 and .254.
Most of the time this number never changes in OpenVPN (and certainly not in WireGuard).
If you setup a ping to your local endpoint say 10.8.0.2 you know the VPN service is up. I would not use the IP of the server, since you get false information if the connection is temporarily lost.

This works for both OpenVPN and WireGuard (tested it), other VPN providers should work too.
Hopes this helps out

leadhex
Posts: 10
Joined: 01 Jul 2015 20:18

Re: Turning VPNs on/off without hassle

Post by leadhex » 21 Jan 2019 19:11

Just found this nice flow and realized it won't work on Android 8.x (Pixel 2). Will wait for an update.

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

Re: Turning VPNs on/off without hassle

Post by gyst » 25 Mar 2019 16:22

I recently started using the latest version of Android. That's why I adjusted the flow to Android 9 (Pie).
Unfortunately I don't know if the adjustments also support Android 8 (Oreo).

I'm going to prepare and publish this version (which is suitable for Android <=7 and =9) here then.
Last edited by gyst on 25 Mar 2019 19:19, edited 2 times in total.

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

Re: Turning VPNs on/off without hassle

Post by gyst » 25 Mar 2019 17:32

Ok, I just updated the flow.

You can get the latest version from here.

I did some cleanup and inserted conditions for Android Pie (version 9).

Those who don't use Android Pie (9) but can't hesitate to test it under Oreo (8) can edit "DirectVPN Expression: android version check" and replace the following with the last line:

Code: Select all

osversion = 9;
osversion >= 8;

Post Reply