Culvert VPN

Stop Android's battery optimiser from killing your VPN

Android's battery optimiser and manufacturer power managers can stop a VPN in the background. Which settings to change, and why Always-on VPN is the fix.

Android how-tos · 4 min read · By Culvert VPN

Android's battery optimiser can stop a VPN app in the background, and when it does the tunnel goes with it. The fix has two parts: set the VPN app's battery use to Unrestricted in Settings > Apps > [app] > Battery, so Android leaves it alone, and turn on Always-on VPN in the system VPN settings, so that if anything does stop it, Android starts it again. On Samsung, Xiaomi and some other phones there is a third part, because the manufacturer's own power manager keeps a separate list of apps allowed to stay alive.

What "battery optimisation" actually does

Android has several mechanisms that limit what apps can do when you are not using them. Doze kicks in when the phone has been still with the screen off; app standby buckets rank apps by how recently you used them and ration their background work accordingly; and per-app battery settings let the system, or you, put an app into a restricted mode where it is stopped whenever it is not on screen.

A VPN is supposed to be exempt from most of this. It runs a foreground service, which is the mechanism Android provides for work that must continue in the background, and it shows the persistent notification that goes with it. In stock Android that is usually respected. But the "Restricted" battery setting overrides it, and manufacturer power managers often ignore it altogether, and either of those means the tunnel drops the moment you lock the phone and put it in your pocket.

The symptoms

  • The VPN is connected while you use the phone and gone when you pick it up an hour later.
  • The status bar key icon disappears overnight.
  • Messages arrive in bursts when you unlock, because background sync was waiting for the tunnel.
  • The app's notification has vanished without you disconnecting.

If instead the VPN drops while you are actively using it, the cause is more likely the network than the optimiser; VPN keeps disconnecting on Android covers those cases.

The settings on stock Android

  1. Open Settings > Apps, find the VPN app and tap it. On Android 12 and newer the path is Settings > Apps > [app] > Battery; on Android 9 through 11 it is Settings > Apps & notifications > [app] > Advanced > Battery > Battery optimisation; on Android 8 it is Settings > Apps & notifications > Special app access > Battery optimisation. Manufacturer menus differ again; searching Settings for "battery optimisation" usually gets there.
  2. Choose Unrestricted (older versions: Not optimised or Don't optimise). This tells Android not to pause the app in the background.
  3. Go to Settings > Network & internet > Data Saver (or Data usage > Data Saver). If Data Saver is on, open Unrestricted data and add the VPN app, or its traffic can be paused while Data Saver is active.
  4. Open Settings > Network & internet > VPN, tap the gear next to the VPN app, and turn on Always-on VPN. The always-on explainer covers what this changes.

Step 4 is the one that matters most. Steps 1 to 3 reduce how often Android stops the app; step 4 makes sure it comes back when something does.

Samsung, Xiaomi and other manufacturer layers

Stock Android's settings are only half of it on many phones. Samsung's Device care has its own "Put unused apps to sleep" behaviour and a "Never sleeping apps" list; Xiaomi's MIUI and HyperOS have an Autostart permission that is off by default and a battery saver setting per app; several other manufacturers ship similar managers under different names. Each is a separate list, and the VPN needs to be on every one that exists on your phone. Keeping a VPN alive on Samsung and Xiaomi phones walks through the exact menus for those two.

Why the VPN is worth exempting

The point of battery optimisation is to stop apps you are not using from spending power. A VPN is not that kind of app. When there is no traffic, an established tunnel sends a small keepalive every so often and otherwise does nothing; the radio sleeps, the processor sleeps. When there is traffic, the VPN encrypts it, which costs a little, but the traffic was going to be sent either way and the radio was going to be awake for it. Exempting the VPN from optimisation does not turn it into a battery hog; it just stops the system killing something that was barely awake. Does a VPN drain your phone battery puts numbers on it.

What actually costs battery is the opposite failure: a VPN that is repeatedly killed and restarted. Each restart is a fresh handshake and a burst of radio activity, and if Always-on VPN is doing that every few minutes because a power manager keeps stopping the app, the phone works harder than it would have with the tunnel simply left up.

Checking it worked

Connect the VPN, lock the phone, and leave it for an hour or more, ideally overnight. When you pick it up, the key icon should still be in the status bar and the app should still show connected, with a session time that has kept counting rather than restarted. If it restarted, Android stopped and always-on recovered it; if it is gone, something on the phone is still stopping the app and always-on is not set.

Culvert VPN runs as a foreground service with the notification Android requires and reads the phone's real always-on state on its Settings screen with a link to turn it on, and it is on Google Play.

Questions people also ask

Will setting the VPN to Unrestricted drain my battery?

Not noticeably. Unrestricted only stops Android from pausing the app; an idle tunnel still sleeps between small keepalives. The power a VPN uses is driven by the traffic you send through it, not by the setting.

Why does the VPN survive on one phone and die on another with the same settings?

Because manufacturers layer their own power managers on top of Android's. Samsung, Xiaomi and others each have a separate list of apps allowed to run in the background, and a VPN needs to be on it.

Is Always-on VPN enough on its own?

Usually. If the VPN is stopped, Android restarts it. Pair it with Unrestricted battery use so it is stopped less often in the first place, and the two together cover nearly every phone.