Notifier Component


Properties

backgroundColor
  Specifies the background color for alerts (not dialogs).
Data type: color
Designer Writable true <notifier name="notifierName" backgroundColor="FF4a0171">
Code Writeable true notifierName.backgroundColor = "FF4a0171"
Code Readable false

notifierLength
  Specifies the length of time that the alert is shown -- either "short" or "long".
Data type: number
Designer Writable true <notifier name="notifierName" notifierLength="0">
Code Writeable false
Code Readable false

textColor
  Specifies the text color for alerts (not dialogs).
Data type: color
Designer Writable true <notifier name="notifierName" textColor="FF77d840">
Code Writeable true notifierName.textColor = "FF77d840"
Code Readable true let variable = notifierName.textColor

class
  The styling class of the the component
Data type: string
Designer Writable true <notifier name="notifierName" class="Test class">
Code Writeable false
Code Readable false

id
  The styling id of the the component
Data type: string
Designer Writable true <notifier name="notifierName" id="Test id">
Code Writeable false
Code Readable false

name
  The name of the component that will be used to refer to it in code.
Data type: string
Designer Writable true <notifier name="notifierName" name="testComponent">
Code Writeable false
Code Readable false

Methods

Method name Description Parameters
dismissProgressDialog Dismisses the alert created by the ShowProgressDialog block
notifierName.dismissProgressDialog()
logError Writes an error message to the Android system log. See the Google Android documentation for how to access the log.
notifierName.logError(message)
notifierName.logError("Test message")
message string
logInfo Writes an information message to the Android log.
notifierName.logInfo(message)
notifierName.logInfo("Test message")
message string
logWarning Writes a warning message to the Android log. See the Google Android documentation for how to access the log.
notifierName.logWarning(message)
notifierName.logWarning("Test message")
message string
showAlert Display a temporary notification.
notifierName.showAlert(notice)
notifierName.showAlert("Test notice")
notice string
showChooseDialog Shows a dialog box with two buttons, from which the user can choose. If cancelable is true there will be an additional CANCEL button. Pressing a button will raise the AfterChoosing event. The "choice" parameter to AfterChoosing will be the text on the button that was pressed, or "Cancel" if the CANCEL button was pressed. If canceled, the TextInputCanceled event will also run.
notifierName.showChooseDialog(message, title, button1Text, button2Text, cancelable)
notifierName.showChooseDialog("Test message", "Test title", "Test button1Text", "Test button2Text", true)
message string
title string
button1Text string
button2Text string
cancelable boolean
showMessageDialog Display an alert dialog with a single button that dismisses the alert.
notifierName.showMessageDialog(message, title, buttonText)
notifierName.showMessageDialog("Test message", "Test title", "Test buttonText")
message string
title string
buttonText string
showPasswordDialog Shows a dialog box where the user can enter password (input is masked), after which the AfterTextInput event will be raised. If cancelable is true there will be an additional CANCEL button. The AfterTextInput and TextInputCanceled events behave the same way as described in ShowTextDialog.
notifierName.showPasswordDialog(message, title, cancelable)
notifierName.showPasswordDialog("Test message", "Test title", true)
message string
title string
cancelable boolean
showProgressDialog Shows a dialog box with an optional title and message (use empty strings if they are not wanted). This dialog box contains a spinning artifact to indicate that the program is working. It cannot be canceled by the user but must be dismissed by the App Inventor Program by using the DismissProgressDialog method.
notifierName.showProgressDialog(message, title)
notifierName.showProgressDialog("Test message", "Test title")
message string
title string
showTextDialog Shows a dialog box where the user can enter text, after which the AfterTextInput event will be raised. If cancelable is true there will be an additional CANCEL button. Entering text will raise the AfterTextInput event. The "response" parameter to AfterTextInput will be the text that was entered, or "Cancel" if the CANCEL button was pressed. If canceled, the TextInputCanceled event will also run.
notifierName.showTextDialog(message, title, cancelable)
notifierName.showTextDialog("Test message", "Test title", true)
message string
title string
cancelable boolean
addEventListener Method used to create event listeners.
See Events below for samples.
eventName string
eventCallbackFunction callback

Events

Event name Description Parameters
afterChoosing Event after the user has made a selection for ShowChooseDialog.
notifierName.addEventListener(
    "afterChoosing",
    function (choice) {
        //Your code here
    }
)
choice string
afterTextInput Event raised after the user has responded to ShowTextDialog.
notifierName.addEventListener(
    "afterTextInput",
    function (response) {
        //Your code here
    }
)
response string
choosingCanceled Event raised when the user cancels choosing an option. ShowChooseDialog.
notifierName.addEventListener(
    "choosingCanceled",
    function () {
        //Your code here
    }
)
textInputCanceled Event raised when the user cancels ShowPasswordDialog, or ShowTextDialog.
notifierName.addEventListener(
    "textInputCanceled",
    function () {
        //Your code here
    }
)