Launch Apps/Settings/Exit JavaScript Functions

You can find the JavaScript test page at https://www.android-kiosk.com/jstest.htm Just set this as the Kiosk URL on your device to test the functions.

Open Settings
Opens Kiosk Browser Settings.

<script>
function openSettings() {
Android.openSettings();
}
</script>
<a href="javascript:openSettings();">Open Settings</a>


Exit Kiosk Browser
Exits Kiosk Browser, you can specify whether a password is required.

<script>
function exitKiosk(requirepassword) {
Android.exitKiosk(requirepassword);
}
</script>
<a href="javascript:exitKiosk(true);">Exit Kiosk</a>
<a href="javascript:exitKiosk(false);">Exit Kiosk (no password)</a>


Open WiFi Settings
Opens WiFi settings, you can specify whether a password is required. Requires version 1.45 or higher.

<script>
function openWIFISettings(requirepassword) {
Android.openWIFISettings(requirepassword);
}
</script>
<a href="javascript:openWIFISettings(true);">Open WiFi Settings</a>
<a href="javascript:openWIFISettings(false);">Open WiFi Settings (no password)</a>


Open WiFi Hotspot Settings
Opens WiFi hotspot settings. Requires version 2.6.4 (build 205) or higher.

<script>
function openWiFiHotspotSettings(requirepassword) {
Android.openWiFiHotspotSettings(requirepassword);
}
</script>
<a href="openWiFiHotspotSettings(true);">Open WiFi Hotspot Settings</a>


Open Application
Method 1. Opens application by specified package name, requires version 2.0.12 or higher.
Method 2. Opens application by specified package name, give Kiosk browser focus after specified interval (milliseconds). Requires version 2.0.22 or higher.

<script>
//OPEN APPLICATION
function openApplication(packagename) {
Android.openApplication(packagename);
}
//OPEN APPLICATION, GIVE KIOSK BROWSER FOCUS AFTER X INTERVAL
function openApplication(packagename, regainFocusInterval) {
Android.openApplication(packagename, regainFocusInterval);
}
</script>
<a href="javascript:openApplication('com.teamviewer.quicksupport.market');">Method 1. Open application</a>
<a href="javascript:openApplication('com.teamviewer.quicksupport.market', 5000);">Method 2. Open application, give Kiosk browser focus</a>


Broadcast Intent
Method 1. Broadcast Intent, requires version 2.0.17 or higher.
Method 2. Broadcast Intent with extras, requires version 2.0.20 or higher.

<script>
//BROADCAST INTENT
function broadcastIntent(intent, allowForeground) {
Android.broadcastIntent(intent, allowForeground);
}
//BROADCAST INTENT WITH EXTRAS
function broadcastIntentExtras(intent, allowForeground) {
var extras = [["keyname1","value1"],["keyname2","value2"]];
Android.broadcastIntent(intent, allowForeground, extras.toString());
}
</script>
<a href="javascript:broadcastIntent('com.yourapp.YOUR_INTENT', false);">Method 1. Broadcast Intent</a>
<a href="javascript:broadcastIntentExtras('com.yourapp.YOUR_INTENT', false);">Method 2. Broadcast Intent (with extras)</a>


Start Service
Starts service with extras, requires version 2.0.31 or higher.

<script>
function startService(intent) {
var extras = [["keyname1","value1"]];
Android.startService(intent, extras.toString());
}
</script>
<a href="javascript:startService('com.procoit.projectcamera.PROCESS_UPLOADS');">Start Service (with extras)</a>


Start Activity with Intent
Starts activity (with extras if provided), requires version 2.0.38 (without extras) or 2.5.8 with extras.

<script>
function startActivityWithIntent(intent, allowForeground, packageName) {
Android.startActivityWithIntent(intent, allowForeground, packageName);
}
function startActivityWithIntentExtras(intent, allowForeground, packageName) {
var extras = [["keyname1","value1"]];
Android.startActivityWithIntent(intent, allowForeground, packageName, extras.toString());
}
</script>
<a href="javascript:startActivityWithIntent('com.esminis.server.STOP', true, 'com.esminis.server.php');">Start Activity (Sample stop Server for PHP seperate app)</a>
<a href="javascript:startActivityWithIntent('com.esminis.server.START', true, 'com.esminis.server.php');">Start Activity (Sample start Server for PHP seperate app)</a>​
<a href="javascript:startActivityWithIntentExtras('com.esminis.server.START', true, 'com.esminis.server.php');">Start Activity with extras (Sample start Server for PHP seperate app)</a>​


Get Installed Applications
Returns array of installed applications, requires version 2.0.40 or higher.

<script>
function getInstalledApplications() {
var apps = Android.getInstalledApplications();
console.log(apps);
return apps;
}
</script>
<a href="javascript:alert(getInstalledApplications());">Get Installed Apps</a>
Was this article helpful?
Thank you!