Namespace mmir.NotificationManager
Defined in: notificationManager.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
alert(message, alertCallback, title, buttonName)
Opens a (native) alert-notification dialog.
|
|
beep(times)
Trigger a beep notification sound.
|
|
confirm(message, alertCallback, title, buttonLabels)
Opens a (native) confirm-notification dialog.
|
|
createSound(name, url, isKeepOnPause)
Create a sound notification.
|
|
init()
|
|
initSound(name)
Initialize a sound notification.
|
|
Check if the execution environment supports #vibrate.
|
|
Check if #vibrate is functional and enabled.
|
|
playSound(name, times, onFinished, onError)
Trigger a sound notification by NAME (needs to be created first).
|
|
setVibrateEnabled(enabled)
Enable or disable #vibrate.
|
|
setVolume(vol)
Set the volume for sound notifications.
|
|
stopSound(name)
Stop a sound notification, if it is playing.
|
|
vibrate(milliseconds)
Trigger a haptic vibration feedback.
|
- Parameters:
- {String} message
- the alert message
- {Function} alertCallback Optional
- callback that is triggered, after dialog was closed
- {String} title Optional
- OPTIONAL the title for the alert dialog (may not be provided / settable in all execution environments)
- {String} buttonName Optional
- OPTIONAL the label for the close button in the alert dialog (may not be provided / settable in all execution environments)
- Parameters:
- {Number} times
- how many times should to beep repeated
- Parameters:
- {String} message
- the confirm message
- {Function} alertCallback Optional
- callback that is triggered, after dialog was closed.
The callback will be invoked with 1 argument:
callback(wasConfirmed : Boolean)
if the OK/CONFIRM button was pressed,wasConfirmed
will betrue
, otherwisefalse
. - {String} title Optional
- OPTIONAL the title for the confirm dialog (may not be provided / settable in all execution environments)
-
{Array
} buttonLabels Optional - OPTIONAL the labels for the buttons of the confirm dialog (may not be provided / settable in all execution environments)
After creation, the sound "theSoundId" can be played via
playSound("theSoundId", 1)
- Parameters:
- {String} name
- the name / identifier for the sound
- {String} url
- the URL for the audio of the sound
- {Boolean} isKeepOnPause Optional
- OPTIONAL
flag indicating, if the audio resources should be keept
when the device goes into pause mode
(may not apply to all execution environments;
e.g. relevant for Android environment)
DEFAULT:false
- Deprecated:
- instead: use mmir.NotificationManager directly
NOTE a sound does not need to be explicitly initialized, playSound
will
automatically initialize the sound if necessary.
Initializing a sound prepares all resources, so that the sound can be immediately played. For instance, a sound that needs to loaded from a remote server first, may take some time before it can be played.
NOTE the sound must be #createSound|created first, before initializing it.
- Parameters:
- {String} name
- the name / identifier for the sound
- See:
- #createSound
If false
is returned, calling the vibrate()
function will have no effect.
- Returns:
- {Boolean}
true
if #vibrate is functional
If false
is returned, calling the vibrate()
function will have no effect.
- Returns:
- {Boolean}
true
if #vibrate is functional
- Parameters:
- {String} name
- the name / identifier for the sound (if
null
, beep notification is used) - {Number} times
- how many times should to beep repeated
- onFinished
- onError
- See:
- #createSound
NOTE: If {@ #isVibrateAvailable} returns false
, enabling will have no effect.
- Parameters:
- {Boolean} enabled
- set vibrate function to
enable
- Parameters:
- {Number} vol
- the new volume: a number between [0, 1]
- Parameters:
- {String} name
- the name / identifier for the sound
Note: The device / execution environment may not support haptic vibration feedback
- Parameters:
- {Number} milliseconds
- duration for vibration in milliseconds. Must be
> 0