Page 3 of 3

Re: Turning VPNs on/off without hassle

Posted: 05 Jul 2018 02:30
by dragon
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?

Re: Turning VPNs on/off without hassle

Posted: 05 Jul 2018 07:24
by digitalstone
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?

Re: Turning VPNs on/off without hassle

Posted: 09 Jul 2018 13:17
by gyst
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).

Re: Turning VPNs on/off without hassle

Posted: 09 Jul 2018 13:31
by gyst
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.

Re: Turning VPNs on/off without hassle

Posted: 30 Aug 2018 18:59
by han@sytsma.co.uk
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

Re: Turning VPNs on/off without hassle

Posted: 21 Jan 2019 19:11
by leadhex
Just found this nice flow and realized it won't work on Android 8.x (Pixel 2). Will wait for an update.

Re: Turning VPNs on/off without hassle

Posted: 25 Mar 2019 16:22
by gyst
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.

Re: Turning VPNs on/off without hassle

Posted: 25 Mar 2019 17:32
by gyst
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;

Re: Turning VPNs on/off without hassle

Posted: 01 Jan 2020 14:03
by schuster666
Hi,
great thing !
But one problem, if you lost your Internet Connection you are loosing VPN to.

I'm creating a flow there the option "always on" is activated.

If always on is active, it is possible to check if VPN connection is on the run (Status Message from android.system).
With "only VPN" there is no message and no control.

I thank you for the idea and the very good preparatory work.

Will send my flow in a few minutes........

Re: Turning VPNs on/off without hassle

Posted: 01 Jan 2020 14:12
by schuster666
schuster666 wrote:
01 Jan 2020 14:03
Hi,
great thing !
But one problem, if you lost your Internet Connection you are loosing VPN to.

I'm creating a flow there the option "always on" is activated.

If always on is active, it is possible to check if VPN connection is on the run (Status Message from android.system).
With "only VPN" there is no message and no control.

I thank you for the idea and the very good preparatory work.

Will send my flow in a few minutes........
Tadaa :-))
http://automagic4android.com/flow.php?i ... 49b0792fe8