· Platform Guides · 8 min read

Clash for Android: VpnService Permissions and Battery Optimization Settings

Learn how Android Clash clients use VpnService, grant VPN permission, and adjust battery settings to prevent background shutdowns.

VPN permission and background operation are separate settings

When connecting for the first time, check that Android allows the Clash client to establish a VPN. Adjust the app's battery settings only if the connection works with the screen on but drops when the screen is locked. If Android still shows the VPN as connected after locking the screen but an app won't load, check whether that app is covered by the VPN and which rule it matches.

VpnService is Android's VPN interface. Clash clients use it to create a local virtual network interface and receive traffic routed to it by the system. In rule mode, connections are then handled according to the configuration: direct, proxied, or blocked. So a key icon in the status bar or a system status of “Connected” only confirms that the VPN interface is active. It doesn't mean the proxy node is working or that every app is routed through the proxy.

First connection: grant permission, confirm status, check rules

  1. Select a configuration. Import and enable a valid configuration in the Clash client. If you see an error such as a failed subscription parse, invalid configuration, or port conflict, resolve it first. Importing a configuration and granting VPN permission are separate steps.
  2. Start VPN mode. If the client offers multiple modes, choose the one that routes traffic through Android VPN, then tap “Start” or “Connect.” When Android displays a connection request, check that the app name is correct and tap “OK.” If you previously tapped “Cancel,” start the connection again in the Clash client to trigger a new request. If permission was already granted, Android may not show the prompt again.
  3. Confirm in system settings. On stock Android, go to Settings → Network & internet → VPN and check that the Clash client you're using is marked “Connected.” If there's no status bar icon, trust this screen. If you can't find the VPN settings, search for “VPN” in Settings.
  4. Test a new connection. Stay on the same Wi-Fi network and open a site that normally works in the same browser. Then check the Clash client's Connections or Logs page for the domain, matched rule, and outbound. If you use per-app routing, make sure the browser is included. Don't rely on cached pages or latency tests to confirm that traffic is being routed.

Android 13 and later may also request notification permission. This is separate from VPN permission: denying notifications won't stop Android from establishing a VPN, but you may not see the running status or quick actions in the notification shade. When troubleshooting, check both the system VPN page and the Clash client.

Battery optimization: settings by device

Here, “whitelist” means exempting the Clash client from battery optimization or background restrictions—not adding it to a direct-connection list in the rules. Start by changing the battery settings for the app itself; there's no need to disable battery saving system-wide. Common settings paths are listed below, but menu names may vary by region, firmware, and OS version.

Device and software Settings path What to check
Pixel · Android 14 Settings → Apps → See all apps → select the Clash client → App battery usage Select “Unrestricted” if available. If you first see “Allow background usage,” enable it, then tap the option's text to check whether “Unrestricted” is available.
Samsung · One UI 6 Settings → Battery → Background usage limits Remove the app from “Sleeping apps” or “Deep sleeping apps,” then add it to “Never sleeping apps.” On some firmware, open battery settings through Device care.
Xiaomi · HyperOS 1 Settings → Apps → Manage apps → select the Clash client → Battery saver Select “No restrictions.” If you can't find this on the app info page, search Settings for “App battery saver,” open the app list, and check the individual app settings.

Troubleshoot screen-lock disconnects and post-reboot connections separately

Battery settings help a running service stay active in the background; autostart settings control whether the system lets an app launch from the background in certain situations. If the connection stays stable when you lock the screen after connecting manually, but doesn't come back after a reboot, don't keep changing the battery exemption. On HyperOS, for example, look for “Background autostart” under Settings → Apps → Permissions, or search for that setting directly. Allowing background autostart doesn't guarantee that the Clash client will connect after boot—the client or system still needs to initiate the connection.

Note the original setting before changing it, then repeat the screen-lock test under the same conditions. Relaxing background restrictions may increase standby battery use. If it doesn't help, restore the original setting and check for network switches or conflicts with another VPN. Don't enable every background option at once.

Disconnects when the screen is locked: check whether the VPN is still running

  1. Run a controlled test on one network. Stay on the same Wi-Fi network. First confirm that a site loads in your browser with the screen on, then lock the screen for five minutes. After unlocking, check the system's VPN page before opening the Clash client, which may reconnect automatically and hide the disconnection. Five minutes is just a starting point for comparison; it doesn't mean the system enters deep sleep at that point. If the connection usually drops after 30 minutes, repeat the test for 30 minutes.
  2. VPN is gone: check the service lifecycle. Check whether the system switched to another VPN, and make sure you haven't tapped “Force stop” in the app info screen. Swiping an app away from Recents isn't the same as force-stopping it, though some manufacturers' firmware may also clear background processes when you do. First run a comparison test by locking the screen without swiping the app away, then decide whether to adjust sleep restrictions.
  3. VPN is still connected: check the traffic path. Open a new page and see whether the Clash client logs the request. If the logs show a domain resolution failure, troubleshoot DNS first. If the expected proxy rule matched but the connection timed out, check the current node and network. If only one app is affected, check its per-app include or exclude list instead of changing system-wide battery settings.
  4. Only fails when switching networks: reproduce that separately. With the screen on, manually switch from Wi-Fi to mobile data, then open the page again instead of waiting for an old download to resume. If a new connection works but the old one drops, a battery exemption usually isn't needed. If new connections fail too, compare the system VPN status with the client logs to see whether the service stopped or outbound traffic became unreachable after the network switch.

If a public Wi-Fi network requires sign-in through a web page, complete the sign-in before testing the VPN again. Also distinguish between regular battery saver and extreme power-saving mode when troubleshooting: the latter may restrict which apps can run, and an app-specific battery setting may not override those restrictions.

Always-on VPN and blocking connections without a VPN

If the Clash client supports “Always-on VPN,” go to Settings → Network & internet → VPN, tap the settings icon next to the client, and enable the option. This lets Android try to start and maintain the VPN, which can help if you otherwise have to reconnect manually after a reboot. If the option isn't available, check whether your client version and device policy support it; there's no need to revoke and regrant permission repeatedly.

“Block connections without VPN” is a separate setting, sometimes called “Block connections that don't use VPN.” When enabled, traffic covered by this setting can't access the internet directly through Android while the VPN is unavailable. Apps excluded from the VPN may also lose network access. This doesn't switch rule mode to global proxy: Clash still selects an outbound for traffic that reaches the VPN, according to its configuration. When troubleshooting for the first time, leave this setting off until manual connections, screen locking, and network switches all work; enable it later if needed.

Download Clash