mmir.NotificationManager
Requires
- module:mmir.MediaManager
Methods
-
alert(message, alertCallback, title, buttonName)
-
Opens a (native) alert-notification dialog.
Name Type Description messageString the alert message alertCallbackfunction optional callback that is triggered, after dialog was closed titleString optional OPTIONAL the title for the alert dialog (may not be provided / settable in all execution environments) buttonNameString optional OPTIONAL the label for the close button in the alert dialog (may not be provided / settable in all execution environments) -
beep(times)
-
Trigger a beep notification sound.
Name Type Description timesNumber how many times should to beep repeated -
confirm(message, alertCallback, title, buttonLabels)
-
Opens a (native) confirm-notification dialog.
Name Type Description messageString the confirm message alertCallbackfunction 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,wasConfirmedwill betrue, otherwisefalse.titleString optional OPTIONAL the title for the confirm dialog (may not be provided / settable in all execution environments) buttonLabelsArray.<String> optional OPTIONAL the labels for the buttons of the confirm dialog (may not be provided / settable in all execution environments) -
createSound(name, url, isKeepOnPause)
-
Create a sound notification.
After creation, the sound "theSoundId" can be played via
playSound("theSoundId", 1)Name Type Description nameString the name / identifier for the sound urlString the URL for the audio of the sound isKeepOnPauseBoolean 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 -
getVolume()
-
-
used by framework to initialize the NotificationManager
-
initSound(name)
-
Initialize a sound notification.
NOTE a sound does not need to be explicitly initialized,
playSoundwill 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
createdfirst, before initializing it.Name Type Description nameString the name / identifier for the sound - See:
-
isVibrateAvailable(){Boolean}
-
Check if the execution environment supports
vibrate.If
falseis returned, calling thevibrate()function will have no effect.Returns:
Type Description Boolean trueif#vibrateis functional -
isVibrateEnabled(){Boolean}
-
Check if
vibrateis functional and enabled.If
falseis returned, calling thevibrate()function will have no effect.Returns:
Type Description Boolean trueif#vibrateis functional -
playSound(name, times)
-
Trigger a sound notification by NAME (needs to be created first).
Name Type Description nameString the name / identifier for the sound (if null, beep notification is used)timesNumber how many times should to beep repeated - See:
-
setVibrateEnabled(enabled)
-
Enable or disable
vibrate.NOTE: If {@ #isVibrateAvailable} returns
false, enabling will have no effect.Name Type Description enabledBoolean set vibrate function to enable -
setVolume(vol)
-
Set the volume for sound notifications.
Name Type Description volNumber the new volume: a number between [0, 1] -
stopSound(name)
-
Stop a sound notification, if it is playing. Has no effect, if the notification is not playing.
Name Type Description nameString the name / identifier for the sound -
vibrate(milliseconds)
-
Trigger a haptic vibration feedback.
Note: The device / execution environment may not support haptic vibration feedback
Name Type Description millisecondsNumber duration for vibration in milliseconds. Must be > 0