KioWare - Kiosk System Software - User Guides

« See All User Guides
KioWare Lite   |   Platform: Android™   |   Version: 3.8

Scripting

KioWare Lite for Android has the ability to perform certain scripting commands that a normal browser cannot support.

KioApp

setActionBarVisibility

  • void KioApp.setActionBarVisibility(bool visible)

Overrides the default toolbar visibility until the current session ends.

resetActionBarVisibility

  • void KioApp.resetActionBarVisibility()

Resets the toolbar visibility override value so that it uses default visibility.

setTabBarVisibility

  • void KioApp.setTabBarVisibility(bool visible)

Overrides the default tab bar visibility until the current session ends.

resetTabBarVisibility

  • void KioApp.resetTabBarVisibility()

Resets the tab bar visibility override value so that it uses default visibility.

KioWareUtils

General Functions

runAppByLabel

  • bool KioWareUtils.runAppByLabel(string label)

Runs an application by the label name as seen in the Android app listing of your tablet.

WARNING 1: Running external apps comes with security risks.  Make sure the app you run is safe.
WARNING 2: We only support running apps when in admin mode if your app is also an admin app.  This is for security, and usability reasons.

getAppIconByLabel

  • string KioWareUtils.getAppIconByLabel(string label)

Attempts to get the icon image of an app.  Returns a base-64 string of the image data, or null if something went wrong.  The base-64 image can be assigned to an image tag like so:

  • el.src = "data:image/png;base64," + base64Data;

setDesktopModeEnabled

  • void KioWareUtils.setDesktopModeEnabled(bool enable)

Toggles which user agent string KioWare Lite for Android sends to websites.  If enabled, a non-Android user agent will be sent.  At session end (and begin), the setting will be toggled back to that which is configured on the Browser tab (see Configuration Tool, Browser Tab, Enable Desktop Browser Mode).

getBuildDetails

  • string KioWareUtils.getBuildDetails()

Used to identify the build/SVN information of KioWare.  This returns a JavaScript Object Notation (JSON) string.  It contains the following members:

  • String BuildTime
  • String BuildMachine
  • String RevisionString [See also getKioProperty below.]
  • int RevisionNumber
  • String RevisionNumberString

The KioWare Lite for Android revision number also displays in the Configuration Tool (see Configuration Tool, Configuration Toolbar, Dropdown Menu).

getKioProperty

  • string KioWareUtils.getKioProperty(string kiowareproperty)

Pass in the name of the desired property and the string value is returned.  If the property name is invalid, then Null is returned.  Properties are as follows:

StartPageReturns the Start Page URL (see Configuration Tool, General Tab, Start Page URL)
SVNRevReturns the value of RevisionString (see getBuildDetails above)
SiteReturns the current site name
KioskReturns the current kiosk name
UnitReturns the current unit name

endSession

  • string endSession()

This function can be used to end the current session (similar to window.external.logoff in windows KioWare).  It has no return value.

setUserPresent

  • void setUserPresent(bool)

This function allows setUserPresent to be manually set to true or false when receiving data.

getLastErrorDetails

  • string KioWareUtils.getLastErrorDetails()

This function is used to return a JavaScript Object Notation (JSON) hash map.

Example:

  • var errinfo = JSON.parse(KioWareUtils.getLastErrorDetails());
    var ecode = errinfo["ERRCODE"];
    var emsg = errinfo["ERRDESC"];
    var eurl = errinfo["ERRURL"];
ERRCODEError code.  Possible values are listed below.
ERRCODE Values
ERROR_AUTHENTICATION
ERROR_BAD_URL
ERROR_CONNECT
ERROR_FAILED_SSL_HANDSHAKE
ERROR_FILE
ERROR_FILE_NOT_FOUND
ERROR_HOST_LOOKUP
ERROR_IO
ERROR_PROXY_AUTHENTICATION
ERROR_REDIRECT_LOOP
ERROR_TIMEOUT
ERROR_TOO_MANY_REQUESTS
ERROR_UNKNOWN
ERROR_UNSUPPORTED_AUTH_SCHEME
ERROR_UNSUPPORTED_SCHEME
ERRDESCBrief message about the error
ERRURLURL that failed

Browser Functions

isUrlBlocked

  • bool KioWareUtils.isUrlBlocked(string url)

Used to test a URL against the browser access control list (see Configuration Tool, Security Tab, Browsing Access List).  Pass in a URL and a boolean is returned (true = blocked, false = allowed).  An incorrect or inaccurate URL will return false.

getLastBlockedUrl

  • string KioWareUtils.getLastBlockedUrl()

Returns the last blocked URL.  This function is most useful when using a custom blocked URL page.  Additional block settings can be found in the Configuration Tool (see Configuration Tool, Security Tab, Browsing Access List).

NavBlocked Page

The default browser navigation block page can be overridden by putting a default.html page in

EXTERNAL_STORAGE_DIR/Android/data/com.adsi.kioware.client.mobile.app/NavBlocked
EXTERNAL_STORAGE_DIRThe tablet root internal storage directory

Note that this page would be the most logical place to use getLastBlockedUrl.  Additional block settings can be found in the Configuration Tool (see Configuration Tool, Security Tab, Browsing Access List).

Error Page

The default browser error page can be overridden by putting an error.html file in

EXTERNAL_STORAGE_DIR/Android/data/com.adsi.kioware.client.mobile.app/NavBlocked
EXTERNAL_STORAGE_DIRThe tablet root internal storage directory

There are three constants that will be searched for and replaced in your error page:

  • $$ERRURL$$: The URL.
  • $$ERRCODE$$: The Android browser error code.
  • $$ERRDESC$$: The Android browser error code description.

KioWare Lite for Android will use a custom default error page.  If you prefer to use Android's default error page instead, you can disable KioWare's default error page by creating the file above as an empty file (file exists but with no content).  Additional browser settings can be found in the Configuration Tool (see Configuration Tool, Browser tab).

requestFocus

  • void requestFocus()

This function can be used to ensure that the browser has focus.  Additional browser settings can be found in the Configuration Tool (see Configuration Tool, Browser tab).

simulateTouchEvent

  • void simulateTouchEvent(float x, float y)

This function can be used to simulate a touch event at the specified coordinates in the browser.  Additional browser settings can be found in the Configuration Tool (see Configuration Tool, Browser tab).

Zoom Functions

getZoom

  • float KioWareUtils.getZoom()

This function can be used to return the current zoom.

zoomIn

  • void KioWareUtils.zoomIn()

This function can be used to increase the zoom.

zoomOut

  • void KioWareUtils.zoomOut()

This function can be used to decrease the zoom.

Battery Functions

isBatteryPresent

  • bool KioWareUtils.isBatteryPresent()

Detects whether the device has a battery or not.

Returnstrue if the device has a battery.

isBatteryCharging

  • bool KioWareUtils.isBatteryCharging()

Detects if the device battery is charging or not.

Returnstrue if the device battery is charging.

getBatteryPercentage

  • int KioWareUtils.getBatteryPercentage()

This function can be used to return the percentage of battery use available.

getBatteryTemp

  • int KioWareUtils.getBatteryTemp()

This function can be used to return the battery temperature (in tenths of a degree Centigrade).

getBatteryVoltage

  • int KioWareUtils.getBatteryVoltage()

This function can be used to return the battery voltage (in millivolts).

getBatteryState

  • string KioWareUtils.getBatteryState()

This function can be used to return the battery state. Possible values are as follows:

  • Charging
  • Discharging
  • Full
  • Not Charging
  • Unknown

getBatteryHealth

  • string KioWareUtils.getBatteryHealth()

This function can be used to return the battery health. Possible values are as follows:

  • Cold
  • Dead
  • Good
  • Over Voltage
  • Overheated
  • Unspecified Failure
  • Unknown

getBatteryDeviceStatus

  • int KioWareUtils.getBatteryDeviceStatus()

This function can be used to return the device status. Possible values are as follows:

0No status
1Off line
2Cover open
4Low paper
8Out of paper
10No recover error
20Recover error
40Serial settings error
80Send status query failed
100Read status query failed
200Paper jam
400Device busy
800Monitor out of range
1000Device full
FFFFAny

Log Functions

LogInfo

  • void KioWareUtils.LogInfo(string msg)

This function can be used to log messages to Logcat Viewer as Info events using a tag of “KioWare”.

LogInfo (Tagged)

  • void KioWareUtils.LogInfo(string tag, string msg)

This function can be used to log tagged messages to Logcat Viewer as Info events.

LogWarn

  • void KioWareUtils.LogWarn(string msg)

This function can be used to log messages to Logcat Viewer as Warning events using a tag of “KioWare”.

LogWarn (Tagged)

  • void KioWareUtils.LogWarn(string tag, string msg)

This function can be used to log tagged messages to Logcat Viewer as Warning events.

LogErr

  • void KioWareUtils.LogErr(string msg)

This function can be used to log messages to Logcat Viewer as Error events using a tag of “KioWare”.

LogErr (Tagged)

  • void KioWareUtils.LogErr(string tag, string msg)

This function can be used to log tagged messages to Logcat Viewer as Error events.

LogDebug

  • void KioWareUtils.LogDebug(string msg)

This function can be used to log messages to Logcat Viewer as Debug events using a tag of “KioWare”.

LogDebug (Tagged)

  • void KioWareUtils.LogDebug(string tag, string msg)

This function can be used to log tagged messages to Logcat Viewer as Debug events.

LogVerbose

  • void KioWareUtils.LogVerbose(string msg)

This function can be used to log messages to Logcat Viewer as Verbose events using a tag of “KioWare”.

LogVerbose (Tagged)

  • void KioWareUtils.LogVerbose(string tag, string msg)

This function can be used to log tagged messages to Logcat Viewer as Verbose events.

Volume Functions

Note: The following volume functions have three basic wrapper functions.  For more information, see the appropriate reference on developer.android.com, as listed below.

setAlarmVolume

  • void KioWareUtils.setAlarmVolume(int percentage)

This function can be used to set the alarm volume of the device.  See note above for information on the related wrapper functions.

setDTMFVolume

  • void KioWareUtils.setDTMFVolume(int percentage)

This function can be used to set the DTMF volume (volume of button beeps) of the device.  See note above for information on the related wrapper functions.

setMusicVolume

  • void KioWareUtils.setMusicVolume(int percentage)

This function can be used to set the music volume of the device.  See note above for information on the related wrapper functions.

setNotificationVolume

  • void KioWareUtils.setNotificationVolume(int percentage)

This function can be used to set the notification volume of the device.  See note above for information on the related wrapper functions.

setRingVolume

  • void KioWareUtils.setRingVolume(int percentage)

This function can be used to set the ring volume of the device.  See note above for information on the related wrapper functions.

setSystemVolume

  • void KioWareUtils.setSystemVolume(int percentage)

This function can be used to set the system volume of the device.  See note above for information on the related wrapper functions.

setVoiceCallVolume

  • void KioWareUtils.setVoiceCallVolume(int percentage)

This function can be used to set the voice call volume of the device.  See note above for information on the related wrapper functions.

getAlarmVolume

  • int KioWareUtils.getAlarmVolume()

This function can be used to return the alarm volume of the device.  See note above for information on the related wrapper functions.

getDTMFVolume

  • int KioWareUtils.getDTMFVolume()

This function can be used to return the DTMF volume (volume of button beeps) of the device.  See note above for information on the related wrapper functions.

getMusicVolume

  • int KioWareUtils.getMusicVolume()

This function can be used to return the music volume of the device.  See note above for information on the related wrapper functions.

getNotificationVolume

  • int KioWareUtils.getNotificationVolume()

This function can be used to return the notification volume of the device.  See note above for information on the related wrapper functions.

getRingVolume

  • int KioWareUtils.getRingVolume()

This function can be used to return the ring volume of the device.  See note above for information on the related wrapper functions.

getSystemVolume

  • int KioWareUtils.getSystemVolume()

This function can be used to return the system volume of the device.  See note above for information on the related wrapper functions.

getVoiceCallVolume

  • int KioWareUtils.getVoiceCallVolume()

This function can be used to return the voice call volume of the device.  See note above for information on the related wrapper functions.

Keyboard Functions

tryShowKeyboard

  • void tryShowKeyboard()

This function can be used when attempting to display the keyboard.

tryHideKeyboard

  • void tryHideKeyboard()

This function can be used when attempting to hide the keyboard.

Faux Event

Note: The following functions do not apply to devices running Android 4.1 and above, which can use JavaScript to start videos.  With these devices, you only need to enable Auto Play (see Configuration Tool, Browser Tab, Enable Media Auto Play).

triggerFauxEvent

  • void triggerFauxEvent(string tag)

This function triggers the fauxEvent function to be called (see fauxEvent below).  It is useful when you need to play a video and Android will not allow this action unless it comes from user interaction.  When called, fauxEvent registers as user interaction and the video can be played dynamically.

fauxEvent

  • function fauxEvent(string tag)

This function will be called shortly after triggerFauxEvent is called (see triggerFauxEvent above).