Correct.
B4X:
Sub Activity_Click
If All_isChecked = True Then
others.StartApp(Starter.App2Package)
Activity.Finish
End If
End Sub
[CODE lang="b4x" title="others"]Sub StartApp (package As String)
Dim In As Intent
Dim pm As PackageManager
In = pm.GetApplicationIntent(package)
Dim List1 As List
List1.Initialize
List1 = QueryIntent(In)
If In.IsInitialized Then
Try
StartActivity(In)
Log(package & " was started...")
Catch
ToastMessageShow("Starting error...", False)
End Try
Else
ToastMessageShow("Starting error (system)...", False)
End If
End Sub
Sub QueryIntent(Intent1 As Intent) As List
Dim r As Reflector
r.Target = r.GetContext
r.Target = r.RunMethod("getPackageManager")
Dim list1 As List
Try
list1 = r.RunMethod4("queryIntentActivities", Array As Object(Intent1, 0), Array As String("android.content.Intent", "java.lang.int"))
Catch
End Try
Return list1
End Sub[/CODE]
[CODE lang="b4x" title="Manifest of the Kiosk app"]'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="33"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>
)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.
AddActivityText(main, <intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>)
AddReceiverText(reboot, <intent-filter>
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<data android:scheme="package"/>
</intent-filter>)
AddApplicationText(<receiver android:name="anywheresoftware.b4a.objects.AdminReceiver2"
android

ermission="android.permission.BIND_DEVICE_ADMIN">
<meta-data android:name="android.app.device_admin"
android:resource="@xml/device_admin" />
<intent-filter>
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
</intent-filter>
</receiver>)
CreateResource(xml, device_admin.xml,
<device-admin xmlns:android="http://schemas.android.com/apk/res/android">
<uses-policies>
<limit-password />
<reset-password />
<force-lock />
</uses-policies>
</device-admin>
)[/CODE]