English
简体中文繁體中文EnglishРусскийفارسی

HomeColumnAndroid

Letting FlClash switch itself

FlClash for Android exposes START, STOP and TOGGLE actions that automation apps such as Tasker and MacroDroid can use to switch the proxy by time, place or Wi-Fi. The action names, the set-up steps and an adb test command.

Checked on

A mechanical timer switch: on at one time, off at another
A mechanical timer switch: on at one time, off at another tony_duell, CC BY 2.0

FlClash's excluded SSIDs switch state when you join a given Wi-Fi, but more involved needs are beyond it, such as "on at nine on weekday mornings, off when I get home to my Wi-Fi" or "proxy only while a particular app is open". For those, hand the switch to an Android automation app.

FlClash's automation interface is deliberately restrained: three actions, start, stop and toggle, with nothing for switching nodes or editing profiles. The upside is safety: other apps can at most switch the proxy and cannot change your configuration. The downside is that complex automations have to be built from those three.

The three actions FlClash provides

FlClash's documentation says apps like Tasker and MacroDroid can start an Activity with these three actions to start, stop or toggle the proxy:

ActionEffect
com.follow.clash.action.STARTStart the proxy
com.follow.clash.action.STOPStop the proxy
com.follow.clash.action.TOGGLEOff if on, on if off
A line of dominoes: one condition triggers, and the actions follow by themselves
A line of dominoes: one condition triggers, and the actions follow by themselves Mrkotmatroskin, CC BY-SA 4.0

Try it with adb first

Turn on USB debugging, connect the phone to a computer and run:

adb test
adb shell am start -a com.follow.clash.action.TOGGLE

If FlClash switches state, the action works; then set it up in the automation app.

Setting it up in Tasker

  1. New profileState → Net → Wifi Connected, enter your home SSID, tick Invert
  2. New taskAdd action: System → Send Intent
  3. Fill in Actioncom.follow.clash.action.START
  4. Set Target to ActivityThe step most often missed; the wrong target does nothing
  5. Exit taskAdd a STOP task to run when home Wi-Fi connects
Tasker: proxy on when leaving home Wi-Fi

MacroDroid works the same way: pick Wi-Fi state or time as the trigger, find "Launch Activity" or "Send Intent" among the actions, and fill in the action.

A wall light switch: automation only presses the switch for you; the rules are still FlClash's
A wall light switch: automation only presses the switch for you; the rules are still FlClash's ParentingPatch, CC BY-SA 3.0

Things to watch

  • The first time the proxy starts, Android asks whether to allow the VPN connection. Start it once by hand in FlClash to grant that, after which automation can start it silently.
  • Add both FlClash and the automation app to the battery optimisation allowlist, or the system may kill them in the background.
  • Reading the Wi-Fi name also needs location permission for the automation app, just as for FlClash's excluded SSIDs.

Common set-ups

Desired effectTriggerAction
On when leaving homeDisconnected from home Wi-FiSTART
Off when homeConnected to home Wi-FiSTOP
On only with a certain appThat app comes to the foregroundSTART, and STOP when it leaves
Off at night to save powerDaily at 23:00STOP
One-tap toggleA home screen shortcutTOGGLE

"On only with a certain app" can also be done with FlClash's access control: allow only that app through the VPN and leave the proxy on. Which is better depends on whether other apps need the proxy too.

Controlling Android TV remotely

FlClash supports Android TV. TVs lack convenient automation apps, but a computer on the same LAN can drive one with adb: turn on network debugging in the TV's developer options, run adb connect <TV IP> on the computer, and once connected use adb shell am start -a com.follow.clash.action.TOGGLE to switch the proxy.

Choosing between this and excluded SSIDs

Excluded SSIDs is FlClash's own feature, needing no other app and no extra permissions for one; if it meets your need, prefer it. Automation apps suit more complex conditions combining time, apps, battery and location. Do not let both manage the same Wi-Fi, or they may fight, one turning on what the other turns off.

Can automation switch nodes or modes?

Only the three actions are published: start, stop and toggle. Modes and nodes can be switched with hotkeys on desktop; on Android it is manual for now.

How is this different from the quick settings tile?

The tile is you pressing; automation presses for you when conditions are met. Use both.

Can iPhone Shortcuts do this?

FlClash has no iOS version, so no.

Do automation apps need root?

No. Sending these actions is like any app opening another app's screen and needs no special permission.

FlClash's window pops up after sending the action; is that normal?

Yes. The actions work by starting a FlClash screen, so the window may flash briefly. To reduce the interruption, add a "go to home screen" action right after.

Next

Related settings

On this page: FlClash Tasker, FlClash automatic toggle, FlClash adb command