Platforms 12 min read

Keep Clash Meta Running in the Background on Android: VpnService Permission and Battery Optimization Settings

Learn what Android’s VpnService permission prompt means and how to adjust battery optimization, auto-start, and background settings on different devices to stop your proxy disconnecting when the screen locks.

First, identify the problem: did the VPN service stop, or did the node lose connectivity?

Clash Meta Android clients typically use Android’s VpnService to route device traffic to the mihomo core for DNS handling, rule matching, and proxy connections. If websites stop loading after the screen locks, the app may not have been killed: a node failure, a switch between Wi-Fi and mobile data, or a DNS timeout can look similar. Identify which layer is failing before changing permissions.

This guide uses common settings on Android 12 through Android 15 as a reference. Labels vary by client, Android version, and device manufacturer. The paths below are common starting points; if you can’t find a setting, search Settings for “battery optimization,” “auto-start,” or “VPN.” Menu paths aren’t identical on every device.

What you observeCheck firstNext step
After unlocking, the client appears stopped and the system VPN is disconnectedBackground restrictions, stopped service, another VPN taking overCheck battery settings and logs around the time the issue occurred
VPN is still connected, but every proxy node times outCurrent network, node reachability, DNSKeep the app in the foreground, switch networks, or try a known-working node
Only one app can’t connectPer-app proxy settings, the app’s network permissions, matched rulesCheck whether the app is excluded and which policy is shown in the connection panel
Connection drops only when switching from Wi-Fi to mobile dataMobile data permission, background data, connection recoveryTest a new page request first; don’t rely solely on whether an existing connection recovers

VpnService permission: allow a local VPN interface

What does the VPN connection prompt authorize?

The first time you start the proxy, Android typically displays a “Connection request” or VPN confirmation prompt, explaining that the app can monitor network traffic. Tap Allow so the client can create a system VPN interface and configure routes, DNS, and other settings. The interface routes traffic to the local core; it doesn’t mean all traffic goes to a single remote VPN server. Whether traffic is sent directly or through a proxy depends on your configuration, proxy mode, and per-app settings.

  1. Open the client, import a working configuration, select a node, and start in Rule mode.
  2. Tap the client’s Start or Connect control. Confirm the app name in Android’s VPN permission prompt, then tap Allow.
  3. Open Settings → Network & internet → VPN, or search for “VPN,” and confirm that the active connection belongs to this client.
  4. Load a new webpage, then check the destination domain and matched policy group in the client’s connection panel.

This isn’t Root access or an accessibility permission. Android’s local VPN routing is different from “system proxy” on desktop: the former creates a VPN interface, while the latter typically lets apps that honor proxy settings connect to an HTTP or SOCKS port. Android clients may not have a TUN toggle with the same name as the desktop version, so there’s no need to look for a matching button in desktop guides.

Typically, only one VPN can run per user or profile

Ad blockers, corporate VPNs, and other proxy tools may all use the same VPN slot. Starting another VPN can cause Android to disconnect the existing one. For troubleshooting, close other VPN apps in the same user or profile. If your device has a work profile or is managed by your organization, an administrator may control these restrictions; don’t remove a corporate profile without checking first.

What battery exemptions, auto-start, and background locking each do

These settings serve different purposes and aren’t interchangeable. Start by adjusting the client alone rather than disabling battery-saving features across your phone. If Extreme Battery Saver is on, turn it off before testing; it may override app-level settings.

  • Battery setting “Unrestricted” or “Don’t optimize”: Reduces restrictions on the app’s background activity and network access, but doesn’t guarantee that its process will stay alive.
  • Allow auto-start or background launch: Lets the app start in response to certain system events or background conditions. This doesn’t mean it will connect immediately at boot; the client must support and enable that feature too.
  • Lock in Recent apps: Some manufacturers use this to keep a “clear all” action from removing the app. It isn’t an Android-wide standard and can’t prevent force stops or every kind of memory cleanup.
  • Background data permission: Controls whether the app can use mobile data in the background. If Data Saver is on, you may also need to allow “Unrestricted data usage” for the app.

Notification permission and foreground services

VPN clients that run continuously typically use a foreground service and show a persistent notification. Android 13 and later added a runtime permission for notifications. Denying it doesn’t itself deny VPN permission or necessarily prevent the foreground service from starting, but it does affect which notifications are shown. Allow the client’s ongoing notification so you can check its status and find the stop control.

Don’t use the notification icon alone to determine whether the process is running: notification categories may be disabled, and the system may hide the VPN status icon. Check the system VPN page, the client’s status, and an actual network request. After force-stopping an app or explicitly stopping its running service, reopen the client to start it again; a background exemption won’t restart it automatically.

Settings by device manufacturer: remove restrictions on the client

Long-press the client icon and open App info. Make sure you’re changing settings for the installed client, not an older app with the same name. After reinstalling, changing the package name, or switching clients, check these permissions again.

DeviceCommon settings pathWhat to check
Pixel / near-stock Android Settings → Apps → See all apps → client → App battery usage; on some versions, go to Battery Allow background usage. If battery options are available, select Unrestricted.
Xiaomi / Redmi (MIUI or HyperOS) Settings → Apps → Manage apps → client → Battery saver; search Settings for “Auto-start” or “Background autostart” Set Battery saver to No restrictions and allow background autostart. In Recent apps, long-press the app card to find the lock option.
Huawei / Honor Android app environments Settings → Battery → App launch; on some devices, find it under Apps & services → App launch Turn off automatic management for the app, then enable auto-launch, secondary launch, and background activity as offered.
OPPO / OnePlus / realme App info → Power usage or Battery usage; search Settings for “Auto-launch management” Allow background activity. Enable auto-start if available, and check whether you can lock the app in Recent apps.
vivo / iQOO Settings → Battery → Background power consumption; iManager → App management → Permission management → Auto-start Allow high background power consumption and auto-start. Menu names vary by system version.
Samsung One UI Settings → Apps → client → Battery; Settings → Battery → Background usage limits Select Unrestricted, remove the app from Sleeping or Deep sleeping apps, and add it to “Never auto sleeping apps” if available.

The Huawei settings paths above apply only to system environments that still support the corresponding Android apps. They don’t mean that every HarmonyOS device can install Android clients. If your device can’t install an APK, check system compatibility before looking for background-running settings.

How to verify that the changes took effect

  1. Return to App info, reopen the battery page, and check that the system hasn’t reverted your selection.
  2. Start the proxy and press Home to return to the home screen. Don’t tap Force stop.
  3. If your system supports locking apps in Recent apps, lock the app card before using your usual cleanup tools. Dismissing a card isn’t a universal background-running test across devices.
  4. Open Mobile data & Wi-Fi or Data usage and allow mobile data and background data.

Always-on VPN: configure it separately from blocking connections without a VPN

Some Android devices offer an “Always-on VPN” setting on the system VPN configuration page. If the client supports it, Android can try to keep the VPN service running or restart it. The client still needs a working configuration to establish a functional proxy connection. If the option is missing or unavailable, don’t try to force it on by changing unfamiliar system settings.

“Block connections without VPN” is a separate setting that’s usually used with Always-on VPN. It blocks traffic that would otherwise bypass the VPN when the VPN is unavailable; it doesn’t improve node reliability. When enabled, a stopped client, failed configuration load, or unavailable node may leave the device unable to access the network.

  • While troubleshooting: Leave connection blocking off until you’ve confirmed that a regular VPN connection works after the screen locks and when switching networks.
  • For continuous VPN routing: If both Android and the client support it, enable Always-on VPN and test again.
  • To block traffic when disconnected: Enable this only if you’re comfortable losing network access when the VPN disconnects. Check that apps excluded from per-app proxying still work as expected.

Test after locking the screen: use a consistent sequence to pinpoint when the connection drops

These time intervals are suggested checkpoints, not measured performance results. Change one category of setting at a time and note the device model, Android version, client version, network type, and when the issue occurs. This helps distinguish an effective battery setting from a node that simply came back online.

  1. At 0 minutes: Connect to stable Wi-Fi, start the proxy, and visit one site that needs a proxy and one that connects directly. Check the policy for each in the connection panel.
  2. After 5 minutes with the screen locked: Unlock the device, check the system VPN status, then make a new request. Note whether the client still shows as running and whether its service restarted.
  3. After 30 minutes with the screen locked: Repeat the checks without charging the device. Passing a short screen-off test doesn’t guarantee it will pass after the device enters a deeper idle state.
  4. Switch from Wi-Fi to mobile data: Turn off Wi-Fi, wait for mobile data to connect, then open a new page. The existing TCP connection may drop; check whether a new connection can be established.
  5. After restarting the device: If you enabled auto-start or Always-on VPN, check the connection after unlocking for the first time. Don’t assume the previous session will resume exactly as it was.

If you have a computer, use ADB to inspect device state

If Android platform tools are installed and USB debugging is enabled, you can inspect idle state, the device idle whitelist, and system connectivity. These are read-only commands; they don’t change the app’s battery settings. Output fields vary by Android version, so a missing field alone doesn’t prove the service has stopped.

adb shell dumpsys deviceidle
adb shell dumpsys deviceidle whitelist
adb shell dumpsys connectivity

deviceidle whitelist without add or remove arguments lists relevant whitelist entries; it doesn’t show every background permission set by the manufacturer. Don’t assume that a package missing from this list means auto-start is disabled. Turn off USB debugging after troubleshooting. Before sharing system output or logs, remove subscription URLs, node credentials, device identifiers, and unnecessary browsing records.

Common issues and what to check first

Why does the connection still drop when the app is set to Unrestricted?

A whitelist can reduce battery-related restrictions, but it can’t fix a core crash, low memory, another VPN taking over, or network problems. First check whether the system VPN is still connected, then look in the client logs around the time of the issue for a stopped service, failed configuration load, or connection timeout. If the problem also occurs while the app is in the foreground, focus on the network and configuration instead of adding more permissions.

Do I need Global mode to keep Rule mode running?

No. Rule, Global, and Direct modes determine where traffic goes; they don’t determine whether Android keeps the app running in the background. Temporarily switching to Global mode can help identify a rule issue, but it won’t fix a service stopped by the system. Switch back to your preferred mode after testing.

How can I reduce battery use after enabling background operation?

Check the client’s background battery use in system battery stats. Reduce unnecessary frequent node tests, configuration updates, and verbose logging. Don’t keep the screen on just to keep the app running, and don’t run continuous speed tests. Compare battery use over similar periods on similar networks, and don’t attribute all power drain from a weak mobile signal to the proxy.

Which settings should I keep enabled?

Keep VPN permission, an appropriate background battery setting, and background network access enabled. On manufacturer-specific systems, allow auto-start and lock the app in Recent apps if needed. After testing at 5 and 30 minutes and during a network switch, decide whether to enable Always-on VPN and connection blocking. For installation and subscription setup, see Getting Started. For configuration help, see Configuration FAQ.

Download Clash