Android Question Start app (service) from my app

Sabotto

Well-Known Member
Licensed User
I would like to launch an external app (OpenVPN) to access a Virtual Private Network, on which my app then performs connection tests.
How can I start the "OpenVPN" app directly from my app when I run it?
I tried this but it doesn't work

B4X:
    Dim in As Intent
    Dim pm As PackageManager
    in = pm.GetApplicationIntent("OpenVPN per Android")
    StartActivity(in) '<==== ERROR: java.lang.RuntimeException: Object should first be initialized (Intent).
 

Sabotto

Well-Known Member
Licensed User
The package name is "de.blinkt.openvpn"
B4X:
    Dim i As Intent
    Dim pm As PackageManager
    i = pm.GetApplicationIntent("de.blinkt.openvpn")
    StartActivity(i)
But i receive this error
java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN flg=0x20000 cmp=com.android.settings/.FaceUnLockSuggestionActivity } from ProcessRecord{d1d17d4 9700:b4a.example/u0a307} (pid=9700, uid=10307) requires huawei.android.permission.HW_SIGNATURE_OR_SYSTEM

In the manifest file i have insert
AddPermission(android.permission.INTERNET)
 
Upvote 0

Sabotto

Well-Known Member
Licensed User
So, it means that I cannot launch the "OpenVPN" app directly from my app. Did I get it right?
 
Upvote 0

Sabotto

Well-Known Member
Licensed User
Erel, searching on the net, I found a post here, and with these instructions I can launch the "OpenVPN" app without errors
B4X:
    Dim i As Intent
    i.Initialize(i.ACTION_MAIN, "")
    i.SetComponent("de.blinkt.openvpn/.LaunchVPN")
    i.PutExtra("de.blinkt.openvpn.shortcutProfileName", "My_profile_name")

Didn't you want me to succeed? ....
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…