This app was mentioned in 16 comments, with an average of 1.56 upvotes
Rather than IFTTT there is an alternate openvpn client for Android that does what you're asking. I actually have mine setup the opposite. I connect to openvpn anytime it connects to a WiFi network I haven't "whitelisted"
https://play.google.com/store/apps/details?id=it.colucciweb.openvpn
Edit: forgot to mention there is a free version though I don't know if it supports autoconnect.
Tasker will do it, but isn't great, IMO. It gets wonky and doesn't work 100% of the time.
I bought this app and defined within the app to exclude routing Pokémon Go traffic through the VPN. So, the VPN stays on and encrypts everything else except Pokémon.
Setup Avast through this app. Assuming Avast supports Open VPN protocol (they should). The app will allow you to NOT route Spotify through the VPN. Very simple and more reliable than Tasker IMO.
https://play.google.com/store/apps/details?id=it.colucciweb.openvpn
Additionally, this app works well with Tasker in case you want to go that route anyway.
You could run OpenVPN on the Pi and automatically connect your phone to it when you're on home wifi. This client let you "connect to vpn only when on this wifi network" or "only when NOT on this wifi network". I've used it for a year or so and had no issues, not even appreciable battery drain.
At home I route openvpn through a pihole server running on a pi. On any other wifi network I connect to pihole on a $3/month vps with a faster connection.
Edit: doesn't works, mainly because of the sony remote app. So if your WiFi is off, it will complain, if you turn it on, then it starts connecting but it stucks there.
Honestly the quickest answer i can give you is this:
If your router supports openVPN, you can start an openVPN server, use an app like OpenVPN Client, also have Sony's Remote app installed.
So you want to control your tv remotely?
I didn't tested this, but i will try it tomorrow.
Since upgrading to lollipop I had no luck with any of the free OpenVPN clients, mainly because my existing network is TAP and not TUN and they all seem to use the native VPN interface now.
I got fed up with trying and bought https://play.google.com/store/apps/details?id=it.colucciweb.openvpn which I'm extremely happy with. It can import ovpn configs, it supports TAP, TUN and has a cool widget to turn profiles on/off.
If you are in a situation that you need to block malware/adware only, Blokada isn't a VPN but uses it to reroute DNS. very easy on the battery. It is NOT going to put all your data into a tunnel and keep it private though. It will help with Malware and adware.
​
Having said that, I moved from it to what you are currently using. i use OpenVPN Client on the Android side so it will drop off the VPN on connections I trust and back onto VPN on those I don't. It seems to be a bit easier on the battery than the other OpenVPN clients I have used in the past.
Honestly, I struggled with the whole OpenVPN thing and Tasker. Ultimately, I ended up buying "OpenVPN Client". Yes it is expensive....but it worked excellent. Tasker setup was a breeze. I recommend using this app over the others. At least that was my research when I did this. I like the app too because it has App Filter feature....lets you pick and choose which apps you want to use the VPN and which you don't want using the VPN.
https://play.google.com/store/apps/details?id=it.colucciweb.openvpn
Personally I like OpenVPN Client. It does cost a few $, but it supports TAP without root, and has an auto connect that I've setup - if not connected to the following SSID's, or on mobile data, then start the VPN connection. As soon as I leave home, it connects and stays connected. If I get in range of a wifi on my list, it auto disconnects.
Well worth the money. (even just for the TAP support)
https://play.google.com/store/apps/details?id=it.colucciweb.openvpn
Use this app. You won't try anything else. Works with Tasker, but also standalone. You can trigger the connection using tasker or using the app. When you are connected to certain WiFi networks , or when not connected to some WiFi networks. Etc. Used to use the OpenVPN app, but this app triggers much faster, and it works better. https://play.google.com/store/apps/details?id=it.colucciweb.openvpn
https://play.google.com/store/apps/details?id=it.colucciweb.openvpn&hl=en
That one is good, although it's $7.99. It's the only one on Android that supports tap interfaces. I haven't had any issues with it.
This is assuming you either pay for an OpenVPN server or host your own. This doesn't just give you a VPN connection.
Also, all VPNs will slow your connection. You're not going to get full speeds over a VPN connection.
Ended up with this https://play.google.com/store/apps/details?id=it.colucciweb.openvpn&hl=en_GB - It worked when I tried it briefly at home (By not including my Home network in the list of ones it shouldn't connect on) but I won't get to try it fully until i'm either at work or somewhere with public hotspots (Most of the coffee shops.etc around here seem to have them).
VyperVPN has a nicer interface but since I already have openVPN servers of my own setup I don't really want to pay someone else monthly for the privilege of using theirs.
Right, it's understandable why it doesn't support it, but this app does somehow: https://play.google.com/store/apps/details?id=it.colucciweb.openvpn
This is the only vpn client on android i know of that supports TAP without needing root. Hope that helps
Sorry forgot to include link to app https://play.google.com/store/apps/details?id=it.colucciweb.openvpn
You could probably setup SoftEther VPN server on your home computer, it has mechanisms that can work around firewalls. I'm assuming your mobile phone is an Android device.
https://www.softether.org/4-docs/2-howto/6.VPN_Server_Behind_NAT_or_Firewall
On my Android device I found this to be the best VPN Client software: https://play.google.com/store/apps/details?id=it.colucciweb.openvpn
Edit: Ugh, looks like that app has been retired for a subscription microtransaction version: https://play.google.com/store/apps/details?id=it.colucciweb.vpnclientpro
If the free features of he above OpenVPN client aren't good enough I'm sure there's other free OpenVPN clients in the Google Play Store that will do the job.
Android does support TAP thru this app.