Ask anyone who runs a tunnel on their phone and you’ll hear the same complaint: it works fine, then quietly dies while the screen is off. In my own logs — and I’ve collected a lot of them since 2019 — roughly seven out of ten dropped tunnels on Android trace back to one thing. Not the server. Battery optimization.
So if your VPN keeps disconnecting on Android and you’ve already blamed your provider, this one’s for you. Here are the seven fixes that actually work, ordered from “do this first” to “only if you’re desperate.”
Before You Fix Anything: Know What’s Killing the Connection
Android kills background processes. That’s not a bug — it’s the design. Doze mode, App Standby, and whatever aggressive task-killer your phone manufacturer bolted on top all compete to shut down anything that isn’t actively on screen.
A VPN tunnel looks exactly like a background process that’s eating battery. So the system treats it like one.
There are three layers where this happens, and you need to fix all three:
- System Doze — Android’s built-in idle mode, kicks in when the screen is off and the phone is stationary
- OEM battery managers — MIUI, One UI, ColorOS, EMUI, and Funtouch all have their own kill switches
- App-level bugs — misconfigured MTU, dead DNS, or a protocol your ISP throttles
Miss one layer and the tunnel keeps dropping. Simple as that.
Fix #1 — Whitelist Your VPN App From Battery Optimization
This is the fix I tell everyone to try first. It solves the problem maybe half the time, which is a great batting average for a thirty-second change.
- Open Settings → Apps → [your VPN app]
- Tap Battery (or “Battery usage”)
- Set it to Unrestricted / Don’t optimize
- Repeat for the protocol client — v2rayNG, NekoBox, HTTP Injector, whatever you’re using
On Android 12 and up, you’ll also find Settings → Battery → Battery optimization → All apps, where you can whitelist things in one pass. Do that.
Heads up: some ROMs re-enable optimization automatically after a system update. If your tunnel suddenly starts dying after an OTA, check this setting before touching anything else.
Fix #2 — Disable the OEM Task Killer
Samsung, Xiaomi, Oppo, Vivo, and Huawei all ship their own process managers on top of Android. They’re ruthless, and they don’t care that your WireGuard handshake is mid-flight.
Here’s where each one hides:
- Xiaomi / POCO (MIUI & HyperOS) — Settings → Apps → Manage apps → your app → Autostart ON, Battery saver → No restrictions
- Samsung (One UI) — Settings → Battery → Background usage limits → add your app to “Never sleeping apps”
- Oppo / Realme (ColorOS) — Settings → Battery → App battery management → Allow background activity
- Huawei (EMUI) — Settings → Battery → App launch → manage manually, enable all three toggles
Also disable “Remove permissions and free up space if unused” for the app. Android will silently strip permissions after a few weeks of low use, and a VPN without the notification permission cannot keep a foreground service alive.
Fix #3 — Lock the App in the Recent Apps Screen
Sounds silly. It works.
On MIUI, ColorOS, and EMUI, open the recent apps view, long-press your VPN app’s card, and tap the little padlock icon. That pins the process so the task killer skips it.
It’s not a documented API — it’s an OEM courtesy — but in my testing it’s the difference between a tunnel that survives an hour of screen-off time and one that dies in four minutes. Learn more about 7 Proven Ways to Fix SSH.
Fix #4 — Change Protocol, Port, or Transport
If the disconnect happens on mobile data but not on Wi-Fi (or vice versa), you’re not fighting Android anymore. You’re fighting your ISP or carrier.
Carriers in a lot of regions throttle or reset connections that look like VPN traffic. Two things help immediately:
- Move to TCP 443. Looks like HTTPS, gets treated like HTTPS. Slower than UDP, but it stays up.
- Try WebSocket + TLS on port
443with a proper SNI, or mKCP if your client supports it (v2rayNG and NekoBox both do).
For WireGuard, port 51820 is the default and every deep packet inspection box on earth knows it. Switch to 443 or 2408 and watch the drops slow down.
Quick test: run ping -c 20 1.1.1.1 on both Wi-Fi and mobile data. If the mobile run shows packet loss above 5%, your tunnel isn’t the problem — the link is.Fix #5 — Rebuild the Config, Don’t Just Reinstall
Reinstalling the app is the advice everyone gives and it almost never fixes anything. The config file is where the rot lives.
Three values cause most silent disconnects:
- MTU — anything above
1400will fragment on some carriers and the tunnel dies quietly. Drop to1350or1280. - SNI / host header — if your server was terminated, the handshake succeeds and every packet after it fails. Check your server logs.
- Keepalive — set persistent keepalive to
25seconds. NAT tables on mobile carriers time out around 30 seconds of silence.
Grab a fresh config from your provider. If you’re still shopping around, honestly, a cheap server with a good protocol beats an expensive server with a bad one — I’ve seen premium VPN subscriptions with worse uptime than a five-dollar box from decent hosting terbaik tier providers.
Fix #6 — Kill Private DNS and Always-On VPN Conflicts
This one is sneaky.
If you have Private DNS set to a hostname (like dns.google or a Cloudflare hostname), Android routes DNS through a separate encrypted channel that can fight with your tunnel’s own DNS handling. Result: the connection looks alive, but nothing resolves, and the client eventually times out and reconnects.
Go to Settings → Network & Internet → Private DNS and set it to Off or Automatic while tunneling. For more on this, see 5 Proven SSH Connection Refused Fixes. For a similar approach, check out 5 Easy Steps to WireGuard Android Setup.
Same story with Always-on VPN. If it’s enabled with “Block connections without VPN” and your app doesn’t implement it properly, every reconnect attempt gets blocked by the system itself. Turn it off, test, turn it back on only if needed.
Fix #7 — Fix the Wi-Fi Side
If drops only happen on Wi-Fi, your router’s DHCP lease or NAT table is probably expiring the mapping. Two things to try:
- Set a static IP for your phone in the router’s DHCP reservation list
- Disable “Wi-Fi power saving” or “Wi-Fi sleep policy” in your phone’s advanced Wi-Fi settings
Also worth checking: some routers ship with a broken IPv6 implementation that breaks tunnel endpoints silently. Disable IPv6 on the router and retest.
FAQ
Why does my VPN disconnect only when the screen is off?
Doze mode. Android suspends background network activity to save power, and your tunnel is collateral damage. Fix #1 and #2 above solve it in most cases.
Is a free VPN more prone to dropping?
Often, yes — but not because it’s free. Free servers are overloaded, and overloaded servers drop sessions. A self-hosted tunnel on a cheap VPS usually holds better than a crowded free tier.
Should I use “Always-on VPN”?
Only if your client implements it correctly. Misconfigured Always-on VPN is itself a common cause of reconnect loops.
How do I know if the problem is my phone or my server?
Test the same config on another device. If it holds there, your phone’s battery manager is the culprit. If it drops everywhere, rebuild the config.
Your Turn
Nine times out of ten, battery optimization and a stale config are the whole story. Start there before you go buying a new laptop terbaik or migrating servers.
Which fix worked for you — or which one stubbornly didn’t? Drop it in the comments, I read all of them. And if you want a clean server to test against, you can grab a free account at claudessh.com and rule out the provider variable entirely.
If this server is full, RouterSSH Hysteria2 is another option with 6,500+ servers across 196 countries.
