Turning VPNs on/off without hassle

Share and discuss your flows and ideas with other users.

Moderator: Martin

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

Re: Turning VPNs on/off without hassle

Post by morpheus999 » 29 Mar 2018 07:13

Thanks !!

Works great !

User avatar
sitruk
Posts: 50
Joined: 14 Jul 2015 14:44

Re: Turning VPNs on/off without hassle

Post by sitruk » 02 May 2018 13:02

Very nice! I am actualy working to automate my PIA VPN via the app. I never thought to do it directly from the Android VPN interface.

I am trying to understand your scripts so I can modify them to automatically connect to a specific VPN. Right now, if I run the flow while my VPN is connected it stil lasks me to select a VPN from the list. So I'm not sure if something is wonky on my phone. I have a Pixel XL, Oreo, Rooted, stock rom.

If you are able to provide any insight or assistance with modifying your flow it would be greatly appreciated.

Thank you

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

Re: Turning VPNs on/off without hassle

Post by gyst » 02 May 2018 14:55

sitruk wrote:Very nice! I am actualy working to automate my PIA VPN via the app. I never thought to do it directly from the Android VPN interface.

I am trying to understand your scripts so I can modify them to automatically connect to a specific VPN. Right now, if I run the flow while my VPN is connected it stil lasks me to select a VPN from the list. So I'm not sure if something is wonky on my phone. I have a Pixel XL, Oreo, Rooted, stock rom.

If you are able to provide any insight or assistance with modifying your flow it would be greatly appreciated.

Thank you
Hi sitruk, the flow should ask which VPN you want to connect to, well at least that is what I intended.
It should recognize by the text "connected" (in case of english) under the respective VPN entry that a connection (not via a 3rd party VPN app) already exists and if that is the case just disconnect the current connection.

If you have multiple VPN entries and always want to connect to a certain VPN entry, you should (in short terms) skip the last condition "VPNs != 1" and adjust the action "connect single VPN" according the id of the VPN entry (starting from top with 0).
A little more detailed:
  • Delete the (false) connection between the last two conditions (VPN connected and VPNs != 1)
  • Make a (false) connection between VPN connected and connect single VPN
  • Open action connect single VPN and adjust the line

    Code: Select all

    click(getElement(vpns,0));
    1st entry is 0, 2nd entry is 1 and so on...
Since I don't have an Android Oreo device, I'm not sure how exactly VPN settings or text elements are handled in Oreo, this could be (if applicable) an explanation that it doesn't work as intended for you.

User avatar
sitruk
Posts: 50
Joined: 14 Jul 2015 14:44

Re: Turning VPNs on/off without hassle

Post by sitruk » 02 May 2018 15:21

gyst wrote:
sitruk wrote:Very nice! I am actualy working to automate my PIA VPN via the app. I never thought to do it directly from the Android VPN interface.

I am trying to understand your scripts so I can modify them to automatically connect to a specific VPN. Right now, if I run the flow while my VPN is connected it stil lasks me to select a VPN from the list. So I'm not sure if something is wonky on my phone. I have a Pixel XL, Oreo, Rooted, stock rom.

If you are able to provide any insight or assistance with modifying your flow it would be greatly appreciated.

Thank you
Hi sitruk, the flow should ask which VPN you want to connect to, well at least that is what I intended.
It should recognize by the text "connected" (in case of english) under the respective VPN entry that a connection (not via a 3rd party VPN app) already exists and if that is the case just disconnect the current connection.

If you have multiple VPN entries and always want to connect to a certain VPN entry, you should (in short terms) skip the last condition "VPNs != 1" and adjust the action "connect single VPN" according the id of the VPN entry (starting from top with 0).
A little more detailed:
  • Delete the (false) connection between the last two conditions (VPN connected and VPNs != 1)
  • Make a (false) connection between VPN connected and connect single VPN
  • Open action connect single VPN and adjust the line

    Code: Select all

    click(getElement(vpns,0));
    1st entry is 0, 2nd entry is 1 and so on...
Since I don't have an Android Oreo device, I'm not sure how exactly VPN settings or text elements are handled in Oreo, this could be (if applicable) an explanation that it doesn't work as intended for you.

Ahh, ok. I see. My VPN is configured in a 3rd party app but it is present in the UI (see screenshot). After making the suggested modifications, the flow appears to open the VPN settings and just hang on the "connect single VPN" action.
Attachments
Screenshot_20180502-111331.png
Screenshot_20180502-111331.png (66.01 KiB) Viewed 4467 times

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

Re: Turning VPNs on/off without hassle

Post by gyst » 04 May 2018 13:29

The modifications I explained in my previous post only apply for the stock Android VPN configuration.
You have to check if the elements in the script from "connect single VPN" will work out for your use case, because it seems like there are some differences, and it can't break out of one of those (3) while-loops.
Show the overlay control and lookup/compare the elements/IDs with your VPN settings.

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

Re: Turning VPNs on/off without hassle

Post by morpheus999 » 13 Jun 2018 19:41

Hi.

Now it dont work because of Android 8.0 API26...
Attachments
Screenshot_20180613-225221.png
Screenshot_20180613-225221.png (185.42 KiB) Viewed 4175 times

User avatar
sitruk
Posts: 50
Joined: 14 Jul 2015 14:44

Re: Turning VPNs on/off without hassle

Post by sitruk » 13 Jun 2018 20:56

My flow is still working on my Pixel XL with android 8 June update.

I just left the PIA notification visible and interact with that for disconnecting. I have PIA auto connect on launch so all I need to do is start the app to connect.

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

Re: Turning VPNs on/off without hassle

Post by morpheus999 » 14 Jun 2018 11:10

sitruk wrote:My flow is still working on my Pixel XL with android 8 June update.

I just left the PIA notification visible and interact with that for disconnecting. I have PIA auto connect on launch so all I need to do is start the app to connect.

But you have to pay for VPN PIA

User avatar
sitruk
Posts: 50
Joined: 14 Jul 2015 14:44

Re: Turning VPNs on/off without hassle

Post by sitruk » 14 Jun 2018 12:06

morpheus999 wrote:
sitruk wrote:My flow is still working on my Pixel XL with android 8 June update.

I just left the PIA notification visible and interact with that for disconnecting. I have PIA auto connect on launch so all I need to do is start the app to connect.

But you have to pay for VPN PIA
This is true.

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

Re: Turning VPNs on/off without hassle

Post by digitalstone » 14 Jun 2018 15:21

In case of using a good and reliable VPN, the rule of fist sounds pretty much like this:
Never settle for free VPN.

PIA VPN offers a great fully-featured 1-year service for the price of 1 month's worth of mobile phone use (2 years payment even less).
I'm not getting payed to say that :D I just take security serious and sharing my personal experience.

Note that they offer no dedicated IP address. More anonymous and safer, but no good if you want to make use of a home-server, ip-camera or other IoT.
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)

Post Reply