Page 1 of 1

Is there a way to make open VPN not to stop while phone goes to sleep?

Posted: Sat Jun 04, 2022 10:37 pm
by nagual
So I have realized that OPEN VPN gets disconnected while my android phone goes to sleep. what is worrying is that I get notifications from apps that I don't want them to know my IP, while my phone is on sleep mode.
When I turn the phone on from the sleep mode, I realize the vpn is being reconnected.
Is there a way to keep OpenVPN on,while the phone goes to sleep?
I have already added the Open VPn connect app to the list of 'never sleeping apps' in the battery, background usage limits, but it does not seem to work.
The same thing happens when I turn on the device from sleeping mode: "transport error, trying to reconnect"
plz help. no app should be able to access my IP when my phone is sleeping. what should I do?

Re: Is there a way to make open VPN not to stop while phone goes to sleep?

Posted: Sun Jun 05, 2022 10:48 am
by nagual
guys, please help a brother out

Re: Is there a way to make open VPN not to stop while phone goes to sleep?

Posted: Mon May 15, 2023 1:59 pm
by AndroidPain
I have the same problem.

What I've found: It only stops when the phone is on battery.

I thought I'd found a work around by leaving the phone plugged into a battery pack, but unfortunately, once the phone is fully charged, the battery pack switches off, and then openvpn stops.

Super annoying because I run a voip app - so I cannot receive calls once the phone goes to sleep.

Re: Is there a way to make open VPN not to stop while phone goes to sleep?

Posted: Mon May 15, 2023 3:15 pm
by mballinger
I have the same issue with IOS. Looking for a way to keep VPN on so that it doesn't prompt for MFA auth everytime it goes to sleep.

Re: Is there a way to make open VPN not to stop while phone goes to sleep?

Posted: Thu May 18, 2023 6:30 am
by AndroidPain
I have found a rather clumsy workaround that enables me to keep receiving calls.

Install connectbot. Turn on all the settings to keep the screen active, keep wifi active, reconnect on disconnect etc.

Not great - because the screen cannot be locked, otherwise the vpn drops, but at least my phone can now receive VOIP phone calls.

I'm running lineageOS on a xiaomi poco m4 - so maybe in a decades time or so when I'm retired I'll have time to investigate properly and maybe build a version of the OS that doesn't have this problem. I have an old alcatel (running stock rom) that "just works" but it's too memory constrained now and I needed a new phone. But I might have to switch the sim back and then use it as an access point for my newer phone where I need the extra ram. The alcatel is a much better size anyway!

Re: Is there a way to make open VPN not to stop while phone goes to sleep?

Posted: Mon Oct 16, 2023 8:27 am
by AndroidPain
I might have found the magic sauce to fix this on Android 13. (I'm running lineageos but possibly similar on other OS)

There is an app "VPNDialog". This also needs to have unrestricted battery.

I haven't yet got proof that this is working but on first glance it looks like it probably is.

Re: Is there a way to make open VPN not to stop while phone goes to sleep?

Posted: Mon Oct 16, 2023 10:03 am
by AndroidPain
Sadly this hasn't worked - It stops the vpn dropping as quickly but it still drops. I suspect it's the underlying networking that is "going to sleep" as I see in the VPN logs that it keeps trying to reconnect but getting "server poll timeout".

Re: Is there a way to make open VPN not to stop while phone goes to sleep?

Posted: Mon Oct 16, 2023 11:10 am
by AndroidPain
As far as I can tell, the option to prevent wifi stopping when the phone sleeps has been removed! Seems to apply to mobile data too although I haven't (yet) checked if there's an option hidden somewhere.

https://developer.android.com/reference ... EEP_POLICY