Platforms 8 min read

Clash for Android: VPN Permissions, Battery Optimization & Background Settings

Learn how Android VPN permissions work and where to disable battery optimization or lock Clash in the background on major Android devices.

Confirm the VPN is connected before changing background restrictions

For your first session, leave your phone’s default battery settings as they are. Import a configuration, choose a node, then start the VPN in the client and confirm that websites load while the screen is on. If it works with the screen on but repeatedly disconnects when locked, add the client to the battery-optimization exemption list first. If disconnections happen only after you tap “Clear all,” start by locking the app in recent apps. These settings address different triggers.

What VpnService permission allows the client to do

VpnService is the VPN service API provided by the Android SDK. Once you grant system permission, the client can create a local TUN interface and read the traffic Android routes through it. Clients running Mihomo (formerly Clash.Meta) can route traffic on the device: requests that match your configuration go through proxy nodes, while requests matching DIRECT connect directly. Which apps use the interface also depends on the client’s per-app rules and system settings.

A VPN icon means the system has established a VPN interface. It does not confirm that your subscription is valid, a node is reachable, or that every connection passes through a remote proxy. Conversely, importing a subscription or enabling a local HTTP proxy port does not mean other Android apps are using the VPN.

First-time permission and VPN conflicts

  1. Tap “Start” or “Connect” in the client. When Android displays a “Connection request,” check the app name and tap “OK.” If you previously tapped “Cancel,” return to the client and try starting it again.
  2. Open Settings and search for “VPN” to check the name of the active connection. On Pixel, go to “Settings” → “Network & internet” → “VPN.” On Samsung One UI 6.1, go to “Settings” → “Connections” → “More connection settings” → “VPN.”
  3. If another app owns the active VPN connection, first check whether it is a personal tool or a VPN required by your organization. Typically, only one VPN can be active per user or work profile. Ad blockers that use a local VPN to filter traffic may also occupy this slot. Contact your administrator about organization-managed connections.

Battery optimization exemptions: adjust settings for one app

“Whitelist” is a general term. Pixel calls the setting “Unrestricted,” Xiaomi uses “No restrictions” under its app battery settings, and Samsung also has sleep lists to check. The paths below refer to the listed OS versions; names may vary by region, firmware, or system update. If you can’t find a setting, long-press the client icon and open “App info,” or search Settings for the last menu item in the table.

Android version Settings path Setting to check
Pixel · Android 14 / 15 “Settings” → “Apps” → “See all apps” → Select the client → “App battery usage” Select “Unrestricted.” If you only see “Allow background usage,” turn it on, then tap the row to see whether an “Unrestricted” option is available.
Samsung · One UI 6.1 “Settings” → “Battery” → “Background usage limits” Remove the client from “Sleeping apps” or “Deep sleeping apps,” then add it to “Never auto sleeping apps.” You can also check whether it is set to “Unrestricted” under “App info” → “Battery.”
Xiaomi / Redmi · MIUI 14, HyperOS 1 Long-press the client icon → “App info” → “Battery saver”; on some versions, search Settings for “Background app battery saver” Set only this client to “No restrictions.” If disconnections happen only after startup or manual cleanup, check “Autostart” separately.
OPPO · ColorOS 14 “Settings” → “Battery” → “More settings” → “App battery management” → Select the client; on some models, go to “App info” → “Battery usage” If you see “Allow background activity,” enable it for the client. Leave other apps’ settings unchanged.

Change one setting at a time, then repeat the screen-lock test on the same network. Keep global battery saver in the same state so you can isolate the effect of each change. App-level settings can reduce background restrictions imposed by Android or the manufacturer, but the system may still kill processes when memory is low, and network interruptions can still affect node connections.

Locking recent apps, autostart, and always-on VPN

Disconnects after tapping Clear all? Lock the app in recent apps

On some Xiaomi and Redmi phones, open recent apps, long-press the client card, and tap the lock icon. Once the card shows a lock, test “Clear all” as you normally would. Some versions put this option under “Lock apps” or “Lock tasks” in the Security app. On some Samsung phones, tap the app icon above its card in recent apps and look for “Keep open.” If there’s no matching option, leave the app-level battery settings as they are.

Locking an app in recent apps is intended to protect it from the manufacturer’s bulk cleanup feature. Tapping “Force stop” in “App info” is different: the lock won’t prevent a force stop, and it doesn’t test background behavior when the screen is locked. If the client simply doesn’t resume after a reboot, search Xiaomi Settings for “Autostart” and check whether the client has its own startup option. Allowing autostart lets the app launch, but whether it restores the tunnel depends on the client.

Want Android to reconnect after a reboot? Check Always-on VPN

If the client supports it, open the system “VPN” page, tap the gear next to the client, and look for “Always-on VPN.” When enabled, Android attempts to start the VPN service when needed. After changing the setting, restart your phone. Once you unlock it, check the system VPN page first, then confirm the client has restored the expected configuration. If the option is missing or disabled, or the service starts but still requires you to select a configuration manually, check client support and device management policies.

Troubleshoot screen-lock disconnects: check background app limits, network changes, and configuration

  1. Establish a baseline with the screen on.Start the client on the same Wi-Fi network and keep the node and routing mode fixed. In a browser, visit one site expected to connect directly and another expected to use the proxy. Then check the connection log for the matched rule and outbound. If requests already fail with the screen on, check the node, DNS, and per-app list first.
  2. Test the screen lock before testing cleanup.Unplug the phone, stay on the same Wi-Fi, and lock the screen for 15 minutes. After unlocking, check the system VPN status before opening the client, so a foreground reconnect doesn’t mask the issue. If the problem doesn’t recur within 15 minutes, extend the test to 30 minutes. These are test intervals, not fixed system timeout values. Then separately test “Clear all” in recent apps.
  3. Test the Wi-Fi-to-mobile-data switch separately.First make sure your plan allows the test, then turn off Wi-Fi while the screen is on. Use the same browser to send a new request—for example, try every 10 seconds and note when it first succeeds. Existing connections often drop when switching networks. If new requests also keep failing, check that mobile data works and whether the client can reconnect on the new network.
  4. Keep a brief troubleshooting record.Note the phone model, OS version, client version, disconnection time, triggering action, and error category. If you ask others for help, redact subscription URLs, tokens, and account details. The error category and trigger are enough to start troubleshooting.

VPN icon is still visible, but some apps won’t load

First check whether per-app settings exclude the app making the request, then see whether the client logged that connection. If there’s a matching log entry, check the matched rule, selected outbound, and error type. If only the proxy outbound fails, compare with a known-working node. If both direct and proxy requests report DNS errors, check DNS and the underlying network first. If the system VPN is still connected, loosening battery restrictions is unlikely to help with this issue.

If disconnections happen only when leaving a particular Wi-Fi network, focus on network switching. If the VPN disappears only after the screen locks, check app battery settings and sleep lists first. If it happens only after tapping “Clear all,” check the recent-app lock. Keep only the setting that addresses the trigger you reproduced. For help importing a configuration or checking the routing mode, see the Getting Started guide’s section on outbound modes.

Download Clash