Trying to enable and disable my vpn when using Uber

So my vpn is always on
On my phone and sometimes i forget to turn it off before i open uber. Thus resulting in me not being where i actually am

Basically i want to automate
When uber is in the foreground.
Disable vpn.
When uber is no longer in the foreground
Enable vpn.

I use WeVpn and the app arguments are literally
StopVpn
And Start Vpn

But i dont know how to set this up properly. I just get a failed error.

the log:

06-24 22:00:00.901 I 15@2: App in foreground?

06-24 22:00:19.316 I 15@6: App start

06-24 22:00:19.324 F 15@6: android.os. RemoteException: Remote stack trace: at com.android.server.am .
ActivityStackSupervisor.checkStartAnyActivityPermission

at com.android.server.am. ActivityStarter.startActivity(ActivityStarter.java:908)

at com.android.server.am. Activitystarter.startActivity (ActivityStarter.java:671)

at com.android.server.am.
ActivityStarter.startActivityMayWait(ActivityStarter.jav

at com.android.server.am. ActivityStarter.execute(ActivityStarter.java:612)

06-24 22:00:19.324 I 15@6: Stopped by failure

Just use Tasker.

New Profile

Condition: App. Choose your VPN app

Entry Task: Plugins>VPN App>Disable VPN Shortcut

Exit Task: Plugins>VPN App>Enable VPN Shortcut

If your VPN app doesn’t have any Tasker compatible plugins, you can use an app like APK analyzer to identify the activity ID for enabling and disabling VPN. Then from there use the same Condition but for the Entry/Exit Task you would use Send Intent.

The app Activity you’re trying to start is likely private. Try clearing the Activity class field, and just use the Package and whatever Action and Extras it supports.

Where did you find documentation for the WeAPN “app arguments”, i couldn’t find any?

If the VPN app supports the Locale/Tasker API, then just use the Plug-in blocks. No need to pay for Tasker.

I can’t find any either. So I’m thinking if this is even possible.

I just wanted to trigger the disconnect or connect feature that the app obviously has.

If the apps doesn’t support automation, as a Tasker plug-in block, or through intents, then your only option is to use the App start block to launch it, followed by an Interact block so simulate a click on a “connect” button.