Clash Android Setup: VpnService Permission & Battery Whitelist Guide

How Clash for Android uses VpnService to build its local tunnel, what happens when battery optimization kills it in the background, and the exact steps to whitelist it on every major phone brand.

B-01What VpnService Is, and Why Clash for Android Can't Avoid It

Desktop versions of Clash (and other mihomo-based clients) usually take over network traffic through system proxy settings or a TUN virtual adapter. Android's security model, however, doesn't let ordinary apps create a TUN device directly. Instead, Android exposes VpnService, an official API that lets an app build a local virtual tunnel once the user has explicitly granted permission, redirecting device traffic into the app for processing before it's forwarded according to proxy rules. Every Android build of Clash — Clash Meta for Android, the FlClash fork, Clash for Android, and others — goes through this same path. It's not a design choice made by any single client; it's the only entry point Android provides for "take over all network traffic" at the system level.

This matters because most issues that look like bugs later on actually come from Android's extra restrictions on VpnService-based apps, not from a flaw in the client itself. Any tunnel built with VpnService triggers a persistent key icon or "Connected to VPN" notice in the status bar — this is a mandatory Android security feature that warns users an app is reading their network traffic. Every proxy tool that uses this technical approach shows this icon; it can't be turned off, doesn't need to be turned off, and isn't a sign anything's wrong with the client.

B-02First Launch: Confirming the VpnService Prompt and Required Permissions

After installing the client, tapping the connect toggle for the first time brings up a standard system dialog along the lines of "An app wants to set up a VPN connection that lets it monitor your network traffic." Android renders this dialog itself — the client has no control over how it looks and can only trigger it. Once you tap "OK/Allow," the system records the client as an authorized VPN app, and it normally won't ask again on future launches, unless the permission gets manually revoked in system settings or the client is reinstalled with a different package name or signing certificate (which Android treats as a brand-new app).

  1. Make sure you tapped "Allow," not "Cancel." If you tap Cancel by mistake, the client usually shows a failed connection or drops back to disconnected — just tap the connect toggle again to bring the prompt back up.
  2. Check notification permissions. Android 13 and later require a runtime notification permission. If it's denied, the client can't keep a persistent notification visible, and on some phones the battery manager treats apps without a foreground notification as idle more aggressively, restricting their background activity. It's worth turning this on.
  3. Watch for the "another VPN app is active" warning. Android only allows one VpnService to be active at a time. If another proxy tool, parental control app, or MDM client is already holding the VPN slot, the Clash client will fail to start or show a conflict — close the other one first, then start Clash.
  4. Check storage or local file access permissions (if importing local config files). Some clients need file access to import a local subscription or rule-set file; denying it can make the import button do nothing when tapped.
NOTE Installing and switching between multiple VpnService-based proxy apps on the same device isn't recommended — VPN authorization is mutually exclusive at the system level, and switching back and forth often causes a "stuck on connecting" freeze. If you see this, check whether another VPN app is still holding the connection.

B-03Killed in the Background: How Battery Management Affects Long-Running Tunnels

A process created by VpnService technically counts as a foreground service, and Android is less aggressive about cleaning up foreground services than ordinary background ones — but that doesn't make it immune to every power-saving mechanism. Recent versions of Android have kept expanding Doze mode and App Standby buckets: when a device sits idle for a while with the screen off and not charging, the system periodically suspends network access and CPU scheduling for apps that aren't whitelisted, even if they're running a foreground service notification. Custom ROMs from Chinese and other manufacturers — MIUI, ColorOS, and similar skins layer their own background-management logic on top of stock Android's power saving, and are generally more aggressive about it, which is why the same client can feel rock-solid on one phone brand and flaky on another.

Typical symptoms: the proxy stops working after the phone's been locked for a while, the key icon stays in the status bar but traffic has actually dropped, or the app needs to be manually reopened a few minutes after being backgrounded before it works again. All of these come down to the process being frozen or throttled by the system — the fix isn't tweaking the client's config, it's excluding the app from battery management at the OS level.

B-04Battery Whitelist Steps for Major Phone Brands

The steps below reflect the common menu layout across recent versions of each manufacturer's software. Exact menu names can shift slightly between OS versions — if you can't find an exact match, search Settings using keywords like "battery," "autostart," or "background."

Stock Android / most other devices

  1. Settings → Apps → find the Clash client → Battery
  2. Change battery optimization (or "allow background activity") from "Optimized" to "Unrestricted"
  3. If there's a separate "auto-launch management" option, enable that too

Xiaomi / Redmi (MIUI, HyperOS)

  1. Settings → Apps → Manage apps → find the client → Battery saver → set to "No restrictions"
  2. On the same screen or under "Permissions," find "Autostart" and turn it on
  3. Security app → App management → Permissions → Autostart management, and confirm the app is allowed

Huawei / Honor (EMUI, HarmonyOS, MagicOS)

  1. Settings → Apps → App launch → find the client, turn off "Manage automatically," and manually enable all three toggles that appear (auto-launch, secondary launch, run in background)
  2. Settings → Battery → More battery settings → App launch management, and confirm it's set to manual with everything allowed

OPPO / OnePlus (ColorOS)

  1. Settings → Battery → App battery usage, find the client, and allow background activity and high battery usage
  2. Phone Manager → Privacy permissions → Autostart management, and enable the toggle for the client

vivo / iQOO(OriginOS / Funtouch OS)

  1. Settings → Battery → High background power consumption, and check the box to allow it for the client
  2. vivo iManager → App management → Permission manager → Autostart, and enable the toggle for the client

Samsung (One UI)

  1. Settings → Apps → find the client → Battery → set battery usage to "Unrestricted"
  2. Settings → Battery and device care → Battery → Background usage limits, and confirm the client isn't listed under "Sleeping apps" or "Deep sleeping apps"
NOTE Every step above accomplishes the same thing: telling Android's battery scheduler that this app needs to keep running in the background with network access, and shouldn't be swept up in the usual sleep/freeze cycle. The three layers — system battery optimization, manufacturer autostart management, and manufacturer high-power-usage whitelisting — are usually independent switches. Missing any one of them can cause the connection to drop after the phone's been idle for a while, so it's worth checking each one rather than assuming a single fix covers everything.

B-05Connected but Sites Still Won't Load: Two VpnService-Related Edge Cases

Besides battery management, there are two other issues that get mistaken for a bad VPN authorization — worth covering separately.

Case 1: Per-app proxy list missing an app

Some Android clients let you choose which apps go through the proxy tunnel and which bypass it, using the addAllowedApplication/addDisallowedApplication APIs that VpnService provides. If you've set it to "only selected apps use the proxy" and forgot to add your browser or target app to the list, that app's traffic skips the tunnel entirely — showing up as "Clash says connected, but the browser still can't reach the site." Check whether per-app proxy mode is set to global or allowlist, and whether the app you're testing with is actually on the list.

Case 2: DNS hijacking and its interaction with TUN mode

Android clients commonly have a "Take over DNS" (or similarly named) toggle that, combined with TUN mode, routes DNS lookups through the tunnel and resolves them according to proxy rules too. If that toggle gets turned off by mistake while the system still has a bad resolution cached from the carrier's DNS, you'll see an intermittent pattern where some domains connect and others don't. In that case, try toggling Airplane Mode on and off to clear the system's DNS cache, then confirm the DNS takeover toggle is switched on.

TIP Once the client is on the battery whitelist, there's a simple way to check whether it's stable: lock the screen and leave the device untouched for at least 30 minutes, then unlock it and check both the connection status and whether sites actually load. That tells you far more about whether the battery settings actually took effect than restarting the client repeatedly does.

B-06Quick Troubleshooting Reference

SymptomWhat to check first
Tapping connect does nothing, no permission promptCheck whether another VPN app is already holding the connection — disconnect it, then retry
Works fine at first, stops after the screen's been locked a whileWhether battery optimization, autostart, and high-power-usage are all whitelisted
Key icon stays in the status bar but sites won't loadPer-app proxy list, DNS takeover toggle, and whether the current node is actually working
Needs to be manually reopened after a few minutes in the backgroundWhether the manufacturer's autostart setting got reset to "smart management" by the system
Has to be re-authorized after updating the clientNormal — a changed signing certificate or package name is treated as a new app by Android

B-07Summary

Using Clash on Android boils down to one chain: VpnService authorization → tunnel setup → traffic forwarding. That chain itself is reliable — nearly all real-world problems come from Android's battery management sitting outside of it. Add the client to the battery optimization whitelist, allow autostart, confirm high-power-usage permission, and then check the per-app proxy list and DNS takeover toggle are set the way you expect. That covers the vast majority of stability issues you'll run into day to day. Menu names vary by manufacturer, but the underlying logic is the same — on an unfamiliar phone, searching Settings for "battery," "autostart," or "background management" will usually get you to the right toggle.

Follow the Steps: Download the Clash Client

Get the official installer for Android and other platforms, then follow the setup guide to finish your first configuration.

Download Clash