Android Question Intent for OpenVPN

ykucuk

Well-Known Member
Licensed User
Longtime User
Hi

how can I set an intent for OpenVPN profile autologin?

my profile name : china

I tried this one. It shows setting page of Sync.

B4X:
Dim i As Intent
i.Initialize(i.ACTION_MAIN, "")
i.SetComponent("net.openvpn.openvpn")
i.PutExtra("net.openvpn.openvpn.AUTOSTART_PROFILE_NAME", "china/autologin")
StartActivity(i)

and this one too. It shows open with dialogue but there is no OpenVPN in this app list.

B4X:
Dim i As Intent
i.Initialize(i.ACTION_VIEW, "")
i.SetComponent("net.openvpn.openvpn")
i.PutExtra("net.openvpn.openvpn.AUTOSTART_PROFILE_NAME", "china/autologin")
StartActivity(i)

None of them works.

You can see the parameters for set intent.

Option 1

Connect

* Action:android.intent.action.VIEW
* Cat: None
* Mime Type:
* Data:
* Extra: net.openvpn.openvpn.AUTOSTART_PROFILE_NAME: example.com/autologin
* Extra:
* Package: net.openvpn.openvpn
* Class: net.openvpn.openvpn.OpenVPNClient
* Target: Activity


Option 2

Connect

Action: net.openvpn.openvpn.CONNECT
Extra: net.openvpn.openvpn.AUTOSTART_PROFILE_NAME: PC {Your profile name}
Extra: net.openvpn.openvpn.AUTOCONNECT: true
Package: net.openvpn.openvpn
Class: net.openvpn.unified.MainActivity
Target: Activity

Disconnect

Action: net.openvpn.openvpn.DISCONNECT
Extra: net.openvpn.openvpn.STOP: true
Package: net.openvpn.openvpn
Class: net.openvpn.unified.MainActivity
Target: Activity
Any help?
 
Last edited:

ykucuk

Well-Known Member
Licensed User
Longtime User
It should be:
B4X:
i.SetComponent("net.openvpn.openvpn/.MainActivity")
Error:
android.content.ActivityNotFoundException: Unable to find explicit activity class {net.openvpn.openvpn/net.openvpn.openvpn.MainActivity}; have you declared this activity in your AndroidManifest.xml?
 
Upvote 0

ykucuk

Well-Known Member
Licensed User
Longtime User
Two options:
B4X:
i.SetComponent("net.openvpn.openvpn/net.openvpn.unified.MainActivity")
'or
i.SetComponent("net.openvpn.openvpn/net.openvpn.openvpn.OpenVPNClient")

it works. thank you
B4X:
Dim i As Intent

i.Initialize(i.ACTION_MAIN , "")

i.SetComponent("net.openvpn.openvpn/net.openvpn.unified.MainActivity")

i.PutExtra("net.openvpn.openvpn.AUTOSTART_PROFILE_NAME", "PC china")

i.PutExtra("net.openvpn.openvpn.AUTOCONNECT", True)

i.PutExtra("net.openvpn.openvpn.APP_SECTION", "PC")

StartActivity(i)
 
Upvote 0
Top