Starting an App from a Web Page in SiteKiosk Android

The SiteKiosk Android Object Model can be used to start any Android app available on a device from a web page. This can be used for example to create a fully individualized start page for SiteKiosk Android or to start an application after providing a password. Note that a SiteKiosk Android Object Model documentation is not publicly available yet but a preliminary version can be obtained by contacting PROVISIO support.

In order to start the application you need to know its guid name, e.g. com.android.calculator2. Either you know this information for the app you would like to start or you can use the SiteKiosk logs to find this information. To do so, just add the desired app in the SiteKiosk configuration under Application -> Android App or Application -> Multiple Applications. Next start SiteKiosk and make sure the app has started at least once. Now close SiteKiosk and open the SiteKiosk log file in the ..\SiteKiosk\Logs folder. Look for an entry with the text System app launched, e.g. System app launched: com.android.calculator2. In our example the guid name we are looking for is com.android.calculator2. This information is required to start that specific app from the code of the web page.

The example HTML code to start the app looks like this:

<!DOCTYPE html>
<html>
<head>
<script>
	//method to initialize the SK Object Model as of SKA 2.5 or higher
	(new Function(_siteKiosk.getSiteKioskObjectModelCode()))();
</script>
<script>
    function startApp() {
        //make sure the SiteKiosk Android Object Method is ready
		siteKiosk.ready(function() {
			//start the Android app by its Guid name
			siteKiosk.system.apps.getByGuid("com.android.calculator2").launch("", "systemApp");
		});
    }
</script>
</head>
<body>
	<button onclick="startApp()">Start App</button>
</body>
</html>

The method _siteKiosk.getSiteKioskObjectModelCode initializes the SiteKiosk Android Object Model. The siteKiosk.ready method makes sure that the SiteKiosk Object Model is ready for use. If that is the case, siteKiosk.system.apps.getByGuid accesses the app and the launch method is used to start it (the default parameters for launch, "" and "systemApp", should be left as is).

Of course you need to change the guid name from the above example (com.android.calculator2) to the guid name of your app for the getByGuid method.

Save the complete code as an html file and place it either locally on the Android device or on a web server. For the purpose of testing you can set the file as the start page of the SiteKiosk Android Browser Application.

You also need to give the html file script permission, so it is allowed to use the SiteKiosk Object Model. Do this under Application -> Browser (or Fullscreen Browser) -> Script permission.

Finally you need to add the app you want to start under Security -> Allow assigned apps.