Control WireGuard with Macros

Dimlos

Well-known member
We have confirmed that it works on Android 10.
If you can't get it to work, you are most likely missing some setting.
Please read the thread carefully and try it by trial and error.
 

OpulentHaven

New member
We have confirmed that it works on Android 10.
If you can't get it to work, you are most likely missing some setting.
Please read the thread carefully and try it by trial and error.
Was not apparent to me that "tunnel_name" was a local variable. I was replacing "tunnel_name" with my tunnel name directly. Now it worked right away. Thanks!
 

mjruotolo

New member
I'm a little confused on how to set up the variable for the macros on the first page. Could anybody help me with that? Thank you.
 

tja42

New member
I'm a little confused on how to set up the variable for the macros on the first page. Could anybody help me with that? Thank you.
Macro Send Intent for WireGuard
"Target":"Broadcast"
"Action":"com.wireguard.android.action.SET_TUNNEL_UP",
"PackageName":"com.wireguard.android",
"ClassName":"com.wireguard.android.model.TunnelManager$IntentReceiver",
"Extra 1 Name" :"tunnel"
"Extra 1 Value": "YOUR_TUNNEL_NAME"
 

mjruotolo

New member
I'm on a pixel 8 running android 14. I can't see to get this to work. I have no issue with Tasker controlling it but can't get macrodroid to do it. See configuration screen shots. Thanks
 

Attachments

  • Screenshot_20240324-204258.png
    Screenshot_20240324-204258.png
    39.6 KB · Views: 8
  • Screenshot_20240324-204254.png
    Screenshot_20240324-204254.png
    119.3 KB · Views: 5
  • Screenshot_20240324-204234.png
    Screenshot_20240324-204234.png
    126.3 KB · Views: 8
  • Screenshot_20240324-204147.png
    Screenshot_20240324-204147.png
    130.5 KB · Views: 8

sbkhbk

New member
@mjruotolo
You are looking at outdated information.
Now you can control WireGuard directly, so the package names are different.
Thanks for your post, through this i was able to configure and set my wireguard activation macro.
But it seems like it doesn't work all the time.
For example, i tried this on an app and it worked, i started to clone the macro to set the vpn activation when i access another app. Now it seems wireguard is not at all activated. What am i missing?
 

OpulentHaven

New member
Thanks for your post, through this i was able to configure and set my wireguard activation macro.
But it seems like it doesn't work all the time.
For example, i tried this on an app and it worked, i started to clone the macro to set the vpn activation when i access another app. Now it seems wireguard is not at all activated. What am i missing?
I'm facing this issue as well in tasker. What happens is that if the wireguard app is not running in the background then this wg intent is not waking it up/launching it in the background. This probably needs to be reported to the wireguard client developers. If you set the macro to make sure wg is running then it always works. In tasker I did not find a way to set it so the app launches in the background.. it always needs to be brought to the foreground and then to the background. Didn't work all the time either if I put it through its paces but whatever.
 

Dimlos

Well-known member
It may simply be an effect of battery optimization.
Recently, task kill issues have been occurring on Pixel devices with different apps, so it may be that some change is affecting this issue.
 
Top