Platform Notes 11-minute read

Clash for Android Keeps Disconnecting in the Background: VpnService Permissions and Battery Optimization

Fix Clash for Android disconnects after screen lock. Check VpnService permissions, persistent notifications, battery optimization, and manufacturer-specific background settings.

Tell background app shutdown apart from VPN replacement and connection failures

If Clash works with the screen on but loses internet after the screen has been off for a while, first check whether the VPN service is still running. Don’t start by reimporting your subscription or changing DNS. Android clients typically use the system VpnService to receive device traffic and pass it to the proxy core. An app being closed, its service stopping, and a node failing are different problems with different fixes.

Reopen the client, but don’t tap Start right away. Note whether it says “Connected” or “Stopped,” then check the VPN status under Settings → Network & internet → VPN. Depending on your device, this may be under “Connections & sharing” or “More connections.” You can also search for “VPN” in Settings. A key icon in the status bar can be a useful clue, but some systems hide it, so don’t rely on the icon alone.

What you seeMost likely causeWhat to do next
The client says Stopped, and the system VPN is disconnectedBackground restrictions, a manual stop, or a process crashCheck battery settings and logs from before the disconnect
Another app shows an active VPN connectionAnother VPN has replaced the connection in the same user profileStop the other VPN, then start Clash
The VPN is still connected, but proxy-enabled sites won’t loadNode, DNS, or routing issueTest the same node with the screen on and check the connection logs
The connection drops only after switching between Wi-Fi and mobile dataThe connection failed to recover after a network switchReconnect and test on each network separately
The VPN has stopped, and no apps can access the internet“Block connections without VPN” is enabledRestore the VPN, or temporarily turn off the blocking option

If the connection is still active, don’t assume the app was killed in the background. Conversely, an automatic recovery when you reopen the app doesn’t mean it was working all along: some clients restart the service when brought to the foreground, masking when the disconnect actually happened.

VpnService permissions: Check the system connection prompt and VPN conflicts

First launch requires system VPN permission

The first time you tap Start or the connect switch, Android usually shows a system “Connection request” dialog asking whether the app can set up a VPN connection. Check that the app name is correct, then allow it. If you cancel, the client may load nodes but won’t be able to route traffic from other apps through the system VPN.

  1. Import your configuration, select a working node, and keep the client open in the foreground.
  2. Tap Start, read the system prompt, and grant permission.
  3. Open the system VPN settings and confirm the connection belongs to this client.
  4. Test in a browser, then lock the screen and observe what happens. Don’t test background behavior before completing the initial permission prompt.

The permission prompt won’t appear every time. If permission was already granted and another VPN hasn’t replaced the connection, it’s normal for the prompt not to appear again. If the button does nothing, check whether an overlay is covering the prompt. Some systems block security confirmations when obscured, so temporarily turn off screen filters or floating controls and try again.

Ad blockers and game boosters can also occupy the VPN connection

Usually, only one active VpnService connection can run in the same Android user or work profile. When another proxy client, a filtering app that uses a local VPN, or a game booster starts, it may revoke the existing connection. If the VPN connects and then immediately drops, stop these apps one by one instead of repeatedly granting Clash permission.

Persistent notifications and battery optimization need separate settings

Allow notifications, allow background activity, and allow background data are three different settings. Notifications show connection status and foreground service information. Battery settings control background restrictions, while background data controls certain network access. Enabling one does not replace the others.

On Android 13 and later, check notification permission first

Go to Settings → Apps → See all apps → your client → Notifications to allow notifications, then check the notification category for connection status. Some manufacturer interfaces also offer Apps info → Manage notifications when you long-press the app icon. If notification sounds are distracting, set that category to silent using the system options instead of turning off notifications for the entire app.

One common misconception needs clearing up: denying notification permission on Android 13 and later does not necessarily prevent a foreground service from starting. Its activity may still appear in the system’s active apps screen. So no notification by itself doesn’t prove the service was killed, but an ongoing status notification makes troubleshooting easier. Manually stopping the app from the active apps screen may end the service outright.

Set the client to Unrestricted or allow it to run in the background

On near-stock Android, go to Settings → Apps → your client → App battery usage → Unrestricted. Other versions may have Settings → Battery → Battery optimization → All apps → your client → Don’t optimize. Menu names vary by system version. The goal is to remove background restrictions for this client, not to disable power saving across the entire device.

  • Allow the client to run without restrictions first: After changing the setting, stop and restart the connection, then lock the screen to test.
  • Check system-wide power saving: Temporarily turn off Battery Saver or Ultra Battery Saver during testing so it doesn’t override the app-specific setting.
  • Check background data: Under “Mobile data & Wi-Fi” or “Data usage” in App info, make sure background data is allowed. If Data Saver is on, also check “Unrestricted data usage.”
  • Avoid force-stopping the app: Force stop ends the app’s components. Autostart or battery exemptions won’t necessarily restart it right away; you’ll usually need to reopen it manually.

Exempting an app from battery restrictions can help, but it can’t guarantee the app will never stop. Low memory, client crashes, system updates, and additional manufacturer policies can still interrupt the service. Continuous background use also consumes extra battery, so exempt only apps that genuinely need it.

Background settings on Xiaomi, Huawei, OPPO, vivo, and Samsung

These are common menu paths, not fixed instructions for every device. Menu names can vary across HyperOS, EMUI, HarmonyOS compatibility environments, ColorOS, OriginOS, and One UI. If you can’t find a setting, search Settings for “autostart,” “battery optimization,” “background,” or “sleeping apps.” Also make sure your system supports the Android client you installed.

Xiaomi and Redmi: Check both autostart and battery settings

  • Long-press the client icon → App info → Battery saver, then choose “No restrictions” or the equivalent option.
  • In the app details under Settings → Apps → Manage apps, or in Security → App management → Permissions → Autostart, find the client and allow it to start automatically.
  • If the recent apps screen supports app locking, long-press the app card and choose the lock icon to reduce the chance of it being removed by “Clear all.”

Locking the app card is only an extra measure; it doesn’t replace battery settings. Don’t assume background permissions are fully configured just because the card is locked.

Huawei and Honor: Check App launch management

Common paths include Settings → Apps & services → App launch management or Phone Manager → App launch management. Find the client, turn off automatic management, then allow “Auto-launch,” “Secondary launch,” and “Run in background” using the options provided. Some Honor models use similar menu names; follow the settings on your device.

Also search Settings for “battery optimization,” switch to all apps, and check whether the client can be exempted. Don’t confuse “Allow background activity” with “Allow notifications”: the former affects how the app runs, while the latter mainly controls notification display.

OPPO, OnePlus, and realme: Check power consumption settings

A common path is Settings → Battery → More settings → App battery management → your client; allow background activity. Some versions provide “Battery management” directly from App info. Then go to Apps → Autostart, or your system’s autostart management page, and make sure the app isn’t blocked from launching. Menu labels may include “Allow background behavior” or “Allow full background behavior.”

vivo and iQOO: Check background power use and autostart

Go to Settings → Battery → Background power consumption management, find the client, and allow high background power use or the equivalent option. Older systems may put this under i Manager. Autostart is usually under Settings → Apps & permissions → Permission management → Autostart. If the system prompts you to manage background power use, don’t restrict the client without checking first.

Samsung: Remove the client from sleeping apps

A common path in One UI is Settings → Battery and device care → Battery → Background usage limits. Newer versions may have Battery directly under Settings. Remove the client from “Sleeping apps” and “Deep sleeping apps.” If there’s a “Never sleeping apps” list, add it there. Also check whether Apps → your client → Battery offers the “Unrestricted” option.

Use Always-on VPN and block-without-VPN settings with care

The system VPN details may include “Always-on VPN” and “Block connections without VPN,” sometimes labeled “Block connections when no VPN is active.” The first asks the system to keep a supported VPN running; the second blocks network traffic from bypassing the VPN when it’s unavailable. They serve different purposes: the kill switch does not keep the app running in the background.

  1. First grant permission and adjust battery settings, then confirm the regular connection stays stable.
  2. If the client supports it, enable “Always-on VPN” if needed. If the option is missing or unavailable, don’t follow instructions meant for another app.
  3. Enable connection blocking only if you need to prevent traffic from bypassing the VPN, and test what happens when it disconnects.

Autoconnect at startup is also different from the app’s “Start on boot” option and the system’s Always-on VPN setting. Whether the client can reconnect after a reboot but before the first unlock depends on its implementation and how it stores configuration. The autostart switch alone doesn’t guarantee full recovery.

Confirm the fix with screen-on, screen-off, and network-switch tests

Don’t change nodes, DNS, and every battery setting at once. If the problem goes away, you won’t know what fixed it. The following repeatable checks provide a useful starting point; the suggested durations are test windows, not results measured on a specific device. Passing a short test doesn’t guarantee a stable connection overnight.

Test phaseAction and durationWhat to record
Screen-on baselineUse the same node for 5 minutesClient status, system VPN status, and whether the target site loads
Screen-off testLeave the device unplugged and idle for 15 minutes, then extend to 30 minutesAfter unlocking, check whether the service stopped, whether the notification is present, and whether it restarted automatically
Network switchTest Wi-Fi to mobile data, then mobile data to Wi-FiWhether the connection drops only after switching and whether a manual reconnect restores it
Extended standbyAfter the short tests, observe the device for 2 hours or leave it idle overnightWhen the connection dropped, battery change, and system power-saving alerts

A 15-minute idle period may not trigger Android’s deep idle state. Idle behavior depends on charging status, movement, and manufacturer implementation, so include a longer test with the device unplugged. If the problem occurs only on company Wi-Fi, check whether the network requires reauthentication. If it happens only on mobile data, first check the client’s mobile data permission and your plan status.

If the VPN stays connected, investigate the node and DNS

If the system shows that the VPN remains connected, use the client’s built-in connection test on the current node, then check the logs for timeouts or DNS errors. A successful latency test only confirms that the test request got a response; it doesn’t guarantee that every site will work. If only one app fails, check the client’s per-app proxy list: the app may be excluded from the VPN or routed to a different policy group by the rules.

Don’t change mixed-port: 7890 just to stop the app from exiting in the background. It controls the mixed proxy listening port and has no direct effect on Android battery restrictions. Updating a subscription fetches configuration; it doesn’t grant background permissions. See the YAML reference for field definitions and the user guide for the basics of importing a profile and starting the client.

Still stopping? Collect version details, timestamps, and crash evidence

If the app keeps stopping after you’ve changed these settings, determine whether the system is terminating the process or the app is crashing. Record your phone model, Android version, full system build number, client version, and core version, along with a timeline such as “Locked the screen around 10:10 p.m.; found the app stopped at 10:35 p.m.” Clash for Android clients aren’t all the same app or version, so “latest version” alone isn’t enough to identify a compatibility issue.

  • Check the app logs first: Look in the client’s Logs or Diagnostics section for entries around the time it stopped. If the process disappears suddenly, the app log may not capture the final cause.
  • Watch for system alerts: Save screenshots of messages like “Background activity restricted” or “App keeps stopping.” These are more useful than a screenshot showing only a failed connection.
  • Check when updates were installed: If the problem started right after a client or system update, back up your configuration, then check the download center for the current maintained release and system requirements.

Use ADB to check system logs if you’re familiar with it

If you’ve set up Android Platform Tools and authorized USB debugging, run the command below on your computer. Reproduce the disconnect, then press Ctrl+C to stop logging. The command saves the system logs the device allows you to read; the available details depend on the device and Android version.

adb devices
adb logcat -v time > android-vpn-log.txt

Look around the time of the failure for process exits, crashes, VPN revocations, or foreground service errors. Don’t conclude that battery settings are responsible based on a single log entry containing “killed.” A USB connection may keep the device charging and change its idle behavior, so use ADB as supporting evidence, not as a substitute for a real screen-off test. Turn off USB debugging when you no longer need it.

Work through the checks in this order: confirm system VPN permission and check for another app using the VPN, then allow background activity and data, test with the screen locked and after network switches, and finally use logs to investigate crashes or connection problems. This separates a stopped service from a service that’s still running without network access, so you can avoid reinstalling repeatedly without addressing the actual restriction.

Download the latest Clash version