i tried to run this sub but it stops the app and does not open the other app
B4X:
Sub ApriMezzi
Dim In As Intent
In.Initialize("","")
In.SetComponent("appinventor.ai_myname.myapp/.Screen1") '<-- for instance "b4a.example/.main"
Dim FLAG_DISMISS_KEYGUARD As Int = 0x00400000
Dim FLAG_TURN_SCREEN_ON As Int = 0x00200000
In.Flags = Bit.Or(FLAG_TURN_SCREEN_ON, FLAG_DISMISS_KEYGUARD )
StartActivity(In)
End Sub
Error occurred on line: 112 (Starter)
android.content.ActivityNotFoundException: Unable to find explicit activity class {appinventor.ai_amorosik4.MEZZI/appinventor.ai_amorosik4.MEZZI.Screen1}; have you declared this activity in your AndroidManifest.xml?
yes i want to open an app made with external app inventor named "mezzi" i know the package and i know the name of the first screen of the app which is Screen1
it gives me a compilation error, but I have already selected the phone library
B4X:
B4A Version: 9.80
Java Version: 11
Analysis of the Code. (0.00s)
Building folders structure. (0.01s)
Compiling the code. error
Error in compiling the program.
Error description: The current declaration does not correspond to the previous one.
Previous: {Type = Phone, Rank = 0, RemoteObject = True}
Current: {Type = PackageManager, Rank = 0, RemoteObject = True}
Line error: 87
Dim p As PackageManager
I also tried this way, but by debugging the message that intent1 is not initialized, can someone help me understand?
B4X:
Dim Intent1 As Intent
Dim pm As PackageManager
Intent1 = pm.GetApplicationIntent("appinventor.ai_miapp.appname")
'Dim Packages As List
'Packages = pm.GetInstalledPackages
'For i = 0 To Packages.Size -1
' Log(Packages.Get(i))
'Next
Try
StartActivity(Intent1)
Catch
ToastMessageShow("Cannot start file. " & CRLF & "appname", False)
End Try