Interface Notification

This plugin provides access to some native dialog UI elements.

Index

Methods

Methods

public alert(message: string, alertCallback: () => void, title?: string, buttonName?: string)

Shows a custom alert or dialog box. Most Cordova implementations use a native dialog box for this feature, but some platforms use the browser's alert function, which is typically less customizable.

Parameters

  • message: string

    Dialog message.

  • alertCallback: () => void

    Callback to invoke when alert dialog is dismissed.

  • title?: string optional

    Dialog title, defaults to 'Alert'.

  • buttonName?: string optional

    Button name, defaults to OK.

public beep(times: number)

The device plays a beep sound.

Parameters

  • times: number

    The number of times to repeat the beep.

public confirm(message: string, confirmCallback: (choice: number) => void, title?: string, buttonLabels?: Array<string>)

Displays a customizable confirmation dialog box.

Parameters

  • message: string

    Dialog message.

  • confirmCallback: (choice: number) => void

    Callback to invoke with index of button pressed (1, 2, or 3) or when the dialog is dismissed without a button press (0).

  • title?: string optional

    Dialog title, defaults to Confirm.

  • buttonLabels?: Array<string> optional

    Array of strings specifying button labels, defaults to [OK,Cancel].

public prompt(message: string, promptCallback: (result: NotificationPromptResult) => void, title?: string, buttonLabels?: Array<string>, defaultText?: string)

Displays a native dialog box that is more customizable than the browser's prompt function.

Parameters

  • message: string

    Dialog message.

  • promptCallback: (result: NotificationPromptResult) => void

    Callback to invoke when a button is pressed.

  • title?: string optional

    Dialog title, defaults to "Prompt".

  • buttonLabels?: Array<string> optional

    Array of strings specifying button labels, defaults to ["OK","Cancel"].

  • defaultText?: string optional

    Default textbox input value, default: "".

public vibrate(time: number)

Vibrates the device for the specified amount of time.

Parameters

  • time: number

    Milliseconds to vibrate the device. Ignored on iOS.