Turning VPNs on/off without hassle
Moderator: Martin
Re: Turning VPNs on/off without hassle
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?
- digitalstone
- Posts: 342
- Joined: 21 Oct 2017 12:36
- Location: The Netherlands
Re: Turning VPNs on/off without hassle
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?
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)
Re: Turning VPNs on/off without hassle
You could adjust the last line from the syslang/translations expression (condition) by replacingdigitalstone 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?
Code: Select all
matches(trim(syslang), check);
Code: Select all
matches(trim(syslang), check) && location;
Re: Turning VPNs on/off without hassle
Sorry, but I still don't have an Oreo device, hence no ability to customize it at the moment.morpheus999 wrote:Hi.
Now it dont work because of Android 8.0 API26...
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.
-
- Posts: 1
- Joined: 29 Aug 2018 11:22
Re: Turning VPNs on/off without hassle
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
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
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
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.
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.
Re: Turning VPNs on/off without hassle
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:
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;
- schuster666
- Posts: 52
- Joined: 13 Nov 2013 14:03
- Location: Germany / Neuss
Re: Turning VPNs on/off without hassle
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........
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........
-- the world would be better without people--
-- but boring --
-- but boring --
- schuster666
- Posts: 52
- Joined: 13 Nov 2013 14:03
- Location: Germany / Neuss
Re: Turning VPNs on/off without hassle
schuster666 wrote: ↑01 Jan 2020 14:03Hi,
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
-- the world would be better without people--
-- but boring --
-- but boring --