Android Question Start app (service) from my app

Similar threads

B4A Question OpenVpn client app hides my app
B4A Question Intent for OpenVPN
B4A Question How To Merge b4a on OpenVpn
B4A Question OpenVPN
B4A Tutorial Version safe APK installation

Sabotto

Active Member
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

Active Member
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)
 

Sabotto

Active Member
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? .... :p
 
Top