For anyone dealing with VPN drops when the screen is off, fast standby battery drain, or unusually high v2rayNG battery usage. Compare VPN on and off over the same network, then check background restrictions or node connectivity based on what happens during the drop. Keep only the settings that solve the problem; you don't need to enable every background-running option.
Check overall battery drain, not just the app's ranking
Open Android Settings → Battery → Battery usage. Check the time period covered, then find v2rayNG's usage details. Depending on your Android version, this may show the app's share of battery use during that period or an estimated amount—not the percentage points your battery lost. An app can rank first simply because you barely used anything else during that time.
- Run two tests on the same Wi-Fi network: first, stop the connection in v2rayNG; then connect to the same node. If “Block connections without VPN” is enabled, only test with the VPN disconnected in an environment where direct connections are allowed. Otherwise, skip the first test and compare two permitted VPN configurations.
- Record the battery level at the start and end of each test. Don't charge the phone or turn on the screen during the test, and keep Battery Saver and mobile data settings consistent. Avoid system updates, photo backups, and large downloads. At the end of the second test, check the VPN status before opening v2rayNG so that launching the app doesn't hide a screen-off disconnect.
- Subtract the ending battery level from the starting level. For example, going from 82% to 80% is a 2-percentage-point drop; this is just an example. If the difference between tests is only one battery increment, repeat them at a similar time of day or extend the test to cover your typical standby period before drawing conclusions.
Bottom line: troubleshoot battery drain and disconnects separately
If repeated tests show higher drain with the VPN connected but no screen-off disconnects, check background traffic and node timeouts before changing battery restrictions. If drain is about the same but the connection drops every time the screen turns off, check the background settings in the next section.
VPN drops when the screen is off: loosen background restrictions one at a time
First, check the connection under Settings → Network & internet → VPN. If the VPN was connected before the screen went off but shows as disconnected when you wake the phone, check whether Android stopped the service. If the VPN still shows as connected but requests time out, follow the log-checking steps below. A connected status only means Android's VPN interface is still active; it doesn't confirm the node is reachable.
- Long-press the v2rayNG icon and open App info, then select App battery usage or Battery. Make sure the app isn't set to Restricted. If your system offers Optimized and Unrestricted, test with Optimized first. If disconnects continue, try Unrestricted for v2rayNG only. On some Android versions, you may need to open Allow background usage to see these options.
- On older Android versions, search Settings for Battery optimization. If the list shows only apps that aren't optimized, switch to All apps, find v2rayNG, and try Don't optimize. This is a common older menu path, separate from the newer App battery usage screen. There's no need to keep changing the same setting just to find every menu.
- Some manufacturers add settings such as App launch management, Auto-start, or Background auto-start. Search for these in Settings. If a running service stops when the screen is off, first check Allow background activity. Check Auto-start only if the service doesn't resume after a reboot. Change one setting at a time and repeat the same screen-off test after each change.
Always-on VPN: choose settings based on your connection needs
Start the VPN successfully in v2rayNG and grant Android's connection request. On stock Android, the usual path is Settings → Network & internet → VPN → the gear icon next to v2rayNG. If you can't find it, search Settings for VPN. Whether Always-on VPN is available depends on your Android version and the app.
- Always-on VPN
- Lets Android maintain or restore the selected VPN service, which is useful if you want a persistent connection. After enabling it, test the connection after unlocking from a reboot and when switching Wi-Fi networks. This setting won't fix node timeouts or guarantee the VPN starts successfully every time.
- Block connections without VPN
- Use this when traffic must not go directly to the internet if the VPN disconnects. With this enabled, losing internet access before the VPN connects may be expected. Apps excluded from the per-app proxy may also be unable to connect; don't assume that excluded apps can always connect directly.
- Connect on demand
- If you use the VPN only at certain times, turn off Always-on VPN and stop the connection in v2rayNG when you're done. If you only need a connection when you start it manually, there's no need to enable auto-start for occasional use.
Per-app proxy: limit which apps use the VPN
This shows the request path for apps included in the VPN. Per-app proxy settings decide which apps send traffic through the VPN; once traffic enters the VPN, Xray selects an outbound route. So an app being included in the VPN doesn't mean every request it makes goes through a remote node. A shorter app list won't necessarily improve battery life—retest under the same screen-off conditions.
- Open the v2rayNG side menu and go to Settings → Per-app proxy. If your version has a Bypass mode option on this page, check how it works: when off, select apps to include in the VPN; when on, select apps to exclude. Double-check the list before saving.
- Start by selecting only the apps you actually need. If a browser works but an app's sign-in page won't open, check whether the sign-in flow launches a separate browser before including it. Don't select every system component by default.
- After saving, stop and restart the v2rayNG connection so Android sets up the VPN with the new app list. Test one selected app and one unselected app. If Block connections without VPN is enabled, evaluate the results according to your no-direct-connection requirements. Don't disable the block just to get an excluded app online.
VPN is connected, but requests time out
Note when the problem occurred and which network you were using, then check the v2rayNG log for entries from the same time. Exact Xray logs vary by request and version; the examples below are useful error snippets to search for. A single occurrence won't explain hours of battery drain—look for errors that persist after the screen turns off or the network changes.
Error: context deadline exceeded
Cause: An operation didn't finish before its deadline. This can happen when a connection or name lookup times out.
Try this: Stay on the same Wi-Fi network. Check the target and operation in nearby log entries, then compare with a known-working node, changing only one variable.
Error: connection reset by peer
Cause: The remote peer or a device along the network path reset the connection. This message alone doesn't mean Android killed the app in the background.
Try this: Retry the same node on Wi-Fi and mobile data separately. If it happens only when switching networks, wait for the connection to stabilize, then check whether new requests work again.
Settings for common scenarios
Battery drains overnight. Should I disable battery optimization?
Not yet. Record the overall battery level before bed and in the morning, and check whether the VPN stayed connected. If you don't need a connection overnight, turn off Always-on VPN and stop the service before bed. If you need to stay connected, leave it on, narrow the per-app list first, then compare overnight battery use.
The VPN no longer drops when the screen is off after I set it to Unrestricted. Should I enable auto-start too?
Not unless you need the VPN to reconnect automatically after a reboot and it doesn't resume when you unlock the phone. In that case, check Android's Always-on VPN setting and the manufacturer's Auto-start setting, changing one at a time. If you normally start the VPN manually, keep your current settings.
The VPN disconnects as soon as I leave Wi-Fi. Should I grant more background permissions?
First test the VPN with Wi-Fi and mobile data separately while the screen is off, then test a network switch on its own. If both networks work independently and the connection only drops briefly during the switch, check whether new requests work again once the switch is complete. An interrupted connection doesn't necessarily mean the VPN service stopped.