Class: Notify

Notify()

Functions to give various notifications to the user (i.e. alerts, vibrations, beeps etc.)

Constructor

new Notify()

Source:

Methods

(static) this.beep()

Plays a short beep on the device
Source:

(static) this.beepSequence(volume, beepData)

Sets a custom beep to play after successful scan
Parameters:
Name Type Description
volume number Value from 0 - 100
beepData Array Array of integer values specifying pairs of tone(Hz) and duration(ms)
Source:
Example
// Sample beep sequence consisting of 2 tones, each with 400ms duration, first one 2000Hz and second one 5000Hz
QBrowser.Notify.beepSequence(100, [2000, 400, 5000, 400]);

(static) this.controlLEDsWithBitMask(bitmask, successFunction, errorFunction)

Enables or disables controllable LEDs on the device based on bit mask
Parameters:
Name Type Description
bitmask number Bit mask of the enabled LEDs [Disabled = 0, Green = 1, Red = 2, Orange = 3, Blue = 4]
successFunction function Callback function if successful
errorFunction function Error callback function. Parameters: - errorMessage(string) - Textual description of the error
Source:

(static) this.enableLineaSpeaker(enabled, successFunction, errorFunction)

Enables or disables external speaker
Parameters:
Name Type Description
enabled boolean Enable or disable external speaker
successFunction function Callback function if successful
errorFunction function Error callback function. Parameters: - errorMessage(string) - Textual description of the error
Source:

(static) this.externalVibrationForTime(time)

Vibrates device for a specified amount of time
Parameters:
Name Type Description
time number The amount of time the vibration will be active
Source:

(static) this.hideActivityIndicator()

Hides the modal activity indicator
Source:

(static) this.message(title, message, buttons, onDismiss)

Shows a pop-up message box on the device and returns the user response
Parameters:
Name Type Description
title string Title of message (this can be null)
message string Message body
buttons Array Array of button names. Ex: {"Accept", "Decline"}. This parameter can be null, in which case a single "Ok" button is displayed.
onDismiss function Callback function that receives the user response. Parameters: - buttonIndex(number) - Button pressed to dismiss message.
Source:
Example
// Example function to display a pop-up
QBrowser.Notify.message("Traffic Ahead", "Do you wish to reroute?", ["Reroute", "Dismiss"], MessageDismissed);

// Example callback function
function MessageDismissed(buttonIndex) {
    PrintOutput("Option " + buttonIndex + " selected");
}

(static) this.play(url, folder, onFailure)

Downloads a sound file and plays it on the device. If the file is already present on the device it uses the local copy.
Parameters:
Name Type Description
url string File url
folder number Folder index for where to store sound file. Use constant from QBrowser.Folder. - Folder.NONE - Sound file will not be stored locally. Every time you play it, it will be downloaded again. - Folder.TEMP - Sound file will be stored in a temporaly folder which gets emptied once every 3 days or when the device runs out of space - Folder.DOCUMENTS - Sound file will be stored in the documents folder permanently
onFailure function Callback function if call failed. Parameters: - errorCode(number) - Error code - errorDescription(string) - Textual description of the error
Source:
Example
QBrowser.Notify.play("http://www.soundjay.com/button/beep-1.wav", QBrowser.Folder.NONE, PlayFailed);

(static) this.showActivityIndicator()

Shows a modal activity indicator indicating a long running function is in progress
Source:

(static) this.vibrate()

Vibrates the device
Source: