v2rayNG Per-App Proxy and Battery Optimization Settings for Android

Fix v2rayNG disconnects in the background and apps bypassing the proxy. Learn how Android VpnService works, configure per-app proxying, battery optimization exemptions, and startup settings.

At a glance

First confirm that v2rayNG's VPN connection works. Then choose which apps use the virtual network interface, and finally address battery optimization and recovery after a reboot. This guide is for Android users whose browser works but other apps do not, or whose connection drops after locking the screen. It separates app selection, Xray routing, and background restrictions so you can troubleshoot each issue independently.

1. VpnService handles traffic capture; Xray handles outbound routing

v2rayNG is an Android client that uses the Xray core to handle proxy connections. When VPN mode is enabled, it uses Android's VpnService to create a virtual network interface and routes traffic from selected apps to the core. The system VPN permission prompt shown on the first connection grants permission to create this interface. It is not a subscription login and does not mean the server is reachable.

There are two separate decisions: per-app settings determine whether an app's traffic enters the VPN; once it does, Xray uses routing rules to send it through the proxy, connect directly, or block it. So selecting a browser does not mean all of its requests will go through a remote server. Requests that match a direct-connection rule may still reach their destination directly.

1
VPN services active at the same time for one user or profile
API 26
Background execution limits introduced in Android 8.0
API 33
Notification runtime permission introduced in Android 13

These are system behaviors, not connection performance metrics. In the same user profile, another app that uses a local VPN for filtering or protection may replace v2rayNG's connection when it starts. Pause such apps before testing. Work profiles and the primary user may have separate VPN management, so don't use an app in a work profile to test the primary user's per-app list.

2. Per-app proxy: choose a mode, then select apps

In v2rayNG, the usual path is Sidebar → Settings → Per-app proxy. The screen typically includes Enable per-app proxy and Bypass mode; labels and menu locations can vary between releases. Follow the on-screen explanation of what selecting an app does. The key question isn't how many apps are selected, but whether selection means include or exclude.

Choose a per-app mode based on which apps should use the VPN

Route only a few apps through the VPN
  • Enable per-app proxy and turn off Bypass mode.
  • Select the browser or other apps whose traffic should enter the VPN.
  • Unselected apps aren't routed through this VPN; their network access may still be affected by system policies.
Route most apps through the VPN
  • Enable per-app proxy and turn on Bypass mode.
  • Select apps to exclude, such as tools that only need local network access.
  • All other apps enter the VPN, then follow the core's routing rules to choose an outbound route.

Read the mode description before selecting apps. The same selection means the opposite thing in each mode.

  1. Establish a baseline

    Turn off per-app proxy, return to the main screen, select a working configuration, and connect. Use a browser to open an HTTPS page that previously worked and confirm the basic connection.

  2. Enable app filtering

    Disconnect, go to Settings → Per-app proxy, and enable per-app proxy. For the first test, select just one browser; don't select system components in bulk.

  3. Confirm what selection means

    If you want only the selected browser to use the VPN, leave Bypass mode off. Don't rely on the switch color alone; check the on-screen explanation of selected apps.

  4. Reconnect

    Return to the main screen and reconnect so the VPN interface uses the updated app list. Close and reopen the target app, then make a new request to rule out existing connections.

  5. Add apps one at a time

    Once the browser test works, add one target app at a time and reconnect. Tracking which change triggers the issue makes it easier to identify a related component or mode problem than selecting every app at once.

App clones, work profiles, and apps with the same name may be separate installations. Don't identify apps by icon alone; check the user, profile label, and system app details. Login, download, or link-opening actions may also be handled by another app. Selecting the main app doesn't guarantee that the component it calls is included too.

3. Battery exemptions: distinguish battery optimization from background activity

If the connection works in the foreground but fails after the screen has been locked for a while, first check whether the service is still running. Android Doze, app standby, and manufacturer background management are separate controls. Allowing background activity can reduce the chance of the app being stopped, but it won't fix an unavailable server or guarantee an uninterrupted connection when the network changes.

SettingCommon pathRecommended action
App battery restrictionsLong-press the v2rayNG icon → App info → Battery or App battery usageIf available, enable Unrestricted or Allow background usage to keep the connection active.
Battery optimization listSettings → Apps → Special app access → Battery optimizationSwitch to all apps, find v2rayNG, and select Don't optimize. Some systems combine or omit this menu.
Notification permissionApp info → NotificationsAllow notifications so you can see the service status and use the disconnect control.
Data Saver restrictionsApp info → Mobile data & Wi-Fi or Data usageCheck that background data is allowed. If Data Saver is on, consider allowing unrestricted data usage.

These are common Android menu paths, not universal paths shared by every manufacturer. If a menu is missing, search system settings for “battery optimization” or “background activity,” then make sure you're changing settings for v2rayNG. Some systems also have a separate background management list where you must allow background activity. Locking the app in recent apps can help, but doesn't replace battery permissions.

4. Auto-start and Always-on VPN: test them separately

Allow auto-start controls whether the system permits the app to start; connect on startup controls whether the client initiates a connection; Always-on VPN is an Android policy that attempts to maintain a specified VPN. These are separate features. Enabling one doesn't mean the others are enabled or working.

  1. Check manufacturer auto-start permissions. In App info or the system's app startup manager, look for Auto-start, Launch other apps, or Run in background. These options aren't available on every device. Enable only the permissions v2rayNG actually needs and that your device provides.
  2. Check the client settings. If your version of v2rayNG offers a startup or auto-connect option under Settings, enable it as described on screen. If your version doesn't include one, don't try to add an undocumented setting.
  3. Review the system VPN policy. A common path is Settings → Network & internet → VPN → settings next to v2rayNG. If your system and client offer Always-on VPN, enable it if needed and verify it by restarting the device.
  4. Test after reboot and unlock. Unlock the device first, then check whether v2rayNG has started and restored the expected configuration before testing app access. Don't assume the app can read its configuration and connect before the first unlock.

After the reboot test passes, test switching from Wi-Fi to mobile data. A network change can invalidate or reset existing TCP connections, so a brief reconnect doesn't necessarily mean the app was stopped in the background. If only one server fails to reconnect, check its compatibility with the current network instead of granting more background permissions.

5. Background disconnects and apps with no access: narrow down the cause

Change one variable at a time. Check in this order: foreground baseline → app filtering → screen lock → network switch → reboot. The suggested timings below are for reproducing issues, not measured results or guarantees of stability. A brief successful test doesn't prove the connection will survive extended idle time.

SymptomTestNext step
Only one app can't connectTemporarily turn off per-app proxy, reconnect, and restart the affected app.If it works, check the mode, selected apps, and any components the app calls. If it still fails, check routing, DNS, and the app's own connection.
VPN service disappears after screen lockLock the screen for 10 minutes, then unlock and check the client status and system VPN settings.Check background restrictions, whether another VPN app has taken over, and logs for a stop or unexpected exit.
Service is running, but requests time outStay on the same network and try a different configuration known to work.Check server reachability, DNS lookups, and routing. The VPN icon alone doesn't point to a battery optimization issue.
Connection fails after switching networksTest on Wi-Fi, then switch to mobile data and make a new request on each network.Check mobile data permissions and network reachability, and review the reconnect logs.

When checking logs, note when the problem occurred, then look for nearby connection failures, name resolution errors, or service stops. A DNS error points to a problem with name resolution; it doesn't prove that an app was excluded from the VPN. The geosite domain groups in routing rules don't replace Android's app selection list; they operate at different levels.

When asking for help, include your Android version, device model, per-app mode, foreground and background behavior, and redacted logs. Remove subscription URLs, authentication details, and server credentials; don't post your full configuration. If you can reproduce the issue with one browser and one server, stick to that minimal setup to reduce troubleshooting variables.

6. FAQs: app selection, battery use, and reconnecting

Why does a selected app still bypass the proxy?

Go to Settings → Per-app proxy and check Bypass mode. When it's enabled, selected apps are excluded. After changing the setting, disconnect and reconnect, then close and reopen the target app. If the problem persists, temporarily turn off per-app proxy for comparison.

Why does the connection still drop after I disable battery optimization?

After unlocking, first check whether the VPN service is still running. If it has stopped, check the manufacturer's background management and other VPN apps. If it is still running, try a known-working server and check logs from the time of the failure. A battery exemption can't fix an unavailable server, DNS timeouts, or network switching issues.

Will routing just one app through the proxy always use less battery?

Not necessarily. Per-app settings reduce the traffic routed through the VPN, but total battery use still depends on data transfer, signal strength, reconnection attempts, and the target app's background activity. Compare results in system Battery usage over the same period and under similar network conditions; a single battery reading isn't conclusive.

Why do I still have to open the app manually after enabling auto-start?

Unlock the device first, then check the manufacturer's auto-start permission and whether the client offers an auto-connect option. Auto-start permission allows the app to launch but doesn't guarantee it will do so every time. If you previously tapped Force stop, open v2rayNG manually and repeat a normal reboot test.

Why do excluded apps lose network access when I close v2rayNG?

Check Block connections without VPN in system VPN settings. If you don't need this blocking policy, turn it off and test again. Then confirm that no other VPN service has taken over. Don't delete your subscription to fix a system-level network policy.

Download v2rayN