[GH-ISSUE #2171] [Feature Request] Android: Add Broadcast Intent support for external automation (Tasker/MacroDroid/Button Mapper) #964

Open
opened 2026-10-14 03:31:52 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @ssdnk on GitHub (Jan 30, 2026).
Original GitHub issue: https://github.com/amnezia-vpn/amnezia-client/issues/2171

Currently, it is impossible to control the AmneziaVPN connection state (Connect/Disconnect/Toggle) programmatically from external automation apps on Android (such as Tasker, MacroDroid, Automate, or Button Mapper).

I have attempted to start the service directly via ADB/Shell using commands like:
am start-foreground-service --user 0 org.amnezia.vpn/.AwgService

However, this fails with a security exception because the services are not exported in the AndroidManifest.xml:
Error: Requires permission not exported from uid 10309

Additionally, the AwgService requires the android.permission.BIND_VPN_SERVICE, which can only be granted by the system, making direct service calls impossible for user apps.

Proposed solution

Please implement a BroadcastReceiver with exported intents to allow external apps to control the VPN tunnel. This is a standard feature in other popular VPN clients (e.g., WireGuard for Android or OpenVPN for Android).

I suggest adding support for intents such as:

  • org.amnezia.vpn.intent.action.CONNECT
  • org.amnezia.vpn.intent.action.DISCONNECT
  • org.amnezia.vpn.intent.action.TOGGLE

This would allow users to send a simple broadcast command to control the VPN without interacting with the UI.

Describe alternatives you've considered

  1. UI Interaction: Using accessibility services to simulate clicks (e.g., via MacroDroid). This is unreliable, requires the screen to be on, and is visually intrusive.
  2. Third-party clients: Using "WG Tunnel" or other clients that support AmneziaWG and have automation APIs. However, I would prefer to use the official Amnezia client.

Additional context

This feature is particularly important for Android TV users. (Or smartphones with additional button). It allows mapping a physical button to instantly toggle the VPN for specific streaming services without leaving the current app or navigating through the VPN client interface.

Originally created by @ssdnk on GitHub (Jan 30, 2026). Original GitHub issue: https://github.com/amnezia-vpn/amnezia-client/issues/2171 Currently, it is impossible to control the AmneziaVPN connection state (Connect/Disconnect/Toggle) programmatically from external automation apps on Android (such as Tasker, MacroDroid, Automate, or Button Mapper). I have attempted to start the service directly via ADB/Shell using commands like: `am start-foreground-service --user 0 org.amnezia.vpn/.AwgService` However, this fails with a security exception because the services are not exported in the `AndroidManifest.xml`: `Error: Requires permission not exported from uid 10309` Additionally, the `AwgService` requires the `android.permission.BIND_VPN_SERVICE`, which can only be granted by the system, making direct service calls impossible for user apps. ### Proposed solution Please implement a **BroadcastReceiver** with exported intents to allow external apps to control the VPN tunnel. This is a standard feature in other popular VPN clients (e.g., *WireGuard for Android* or *OpenVPN for Android*). I suggest adding support for intents such as: - `org.amnezia.vpn.intent.action.CONNECT` - `org.amnezia.vpn.intent.action.DISCONNECT` - `org.amnezia.vpn.intent.action.TOGGLE` This would allow users to send a simple broadcast command to control the VPN without interacting with the UI. ### Describe alternatives you've considered 1. **UI Interaction:** Using accessibility services to simulate clicks (e.g., via MacroDroid). This is unreliable, requires the screen to be on, and is visually intrusive. 2. **Third-party clients:** Using "WG Tunnel" or other clients that support AmneziaWG and have automation APIs. However, I would prefer to use the official Amnezia client. ### Additional context This feature is particularly important for Android TV users. (Or smartphones with additional button). It allows mapping a physical button to instantly toggle the VPN for specific streaming services without leaving the current app or navigating through the VPN client interface.
Author
Owner

@good-vi commented on GitHub (Mar 30, 2026):

Also you can build by yourself it

https://github.com/good-vi/amnezia-client

using docker:

REBUILD=1 ./deploy/build_android_docker.sh --apk arm64-v8a --debug

apk placed here:

amnezia-client/deploy/build/client/android-build/build/outputs/apk/debug/
<!-- gh-comment-id:4154040145 --> @good-vi commented on GitHub (Mar 30, 2026): Also you can build by yourself it https://github.com/good-vi/amnezia-client using docker: ```sh REBUILD=1 ./deploy/build_android_docker.sh --apk arm64-v8a --debug ``` apk placed here: ``` amnezia-client/deploy/build/client/android-build/build/outputs/apk/debug/ ```
Author
Owner

@kolayuk commented on GitHub (Nov 1, 2026):

can you may be raise a PR with that commit? not to build custom builds everytime with major protocol updates

<!-- gh-comment-id:6559329649 --> @kolayuk commented on GitHub (Nov 1, 2026): can you may be raise a PR with that commit? not to build custom builds everytime with major protocol updates
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amnezia-client#964
No description provided.