Deutsche Version   Deutsche Version


Note: The presentation of the notification is heavily dependent on the implementation by the device manufacturer.

Reference UrsNotification

Note:
Modifying a property or calling a function that modifies a notification does not affect notifications already displayed. It only has an effect on the next create.

Functions SetProgress, SetProgressEx, RemoveProgressBar and RemoveProgressBarEx that modify the progess bar of the notification are the only exceptions.

 

Note:
The Title and Text properties and parameters accept HTML tags. This is not mentioned in the description of the individual elements. Which HTML tags can be used varies depending on the implementation of the Android system. There are hints at Mark Murphy's Technical Stuff or Daniel Lew's Coding Thoughts.

Properties

AreNotificationsEnabled
Added in API level 24.
Returns whether notifications from the calling package are not blocked. Returns true for API-Levels < 24.
AreNotificationsPaused
Added in API level 29.
Returns whether notifications from this package are temporarily hidden. This could be done because the package was marked as distracting to the user or because the package is suspended. Returns false for API-Levels < 29.
AutoCancel
Make this notification automatically dismissed when the user touches it.
BigPicture
Added in API level 16.
Provides the bitmap to be used as the payload for the BigPicture notification.
CancelOnDestroy
The notification is canceled when the App is closed.
Color
 Added in API level 21.
The accent color to use.
Colorized
Added in API level 26.
Set whether this notification should be colorized. When set, the color set with Color will be used as the background color of this notification.
This should only be used for high priority ongoing tasks like navigation, an ongoing call, or other similarly high-priority events for the user.
IsInsistent
The audio will be repeated until the notification is cancelled or the notification window is opened.
IsOngoingEvent
This notification is in reference to something that is ongoing, like a phone call. The user can't cancel the notification.
LargeIcon
Add a large icon to the notification content view. In the platform template, this image will be shown either on the right of the notification, with an aspect ratio of up to 16:9, or (when the notification is grouped) on the left in place of the small icon.
NoClear
The notification should not be canceled when the user clicks the Clear All button.
NumberID
The unique Id of this notification. A new notification with the same NumberID updates an existing one.
OnlyAlertOnce
Sound, vibrate and ticker are played if the notification is not already showing.
SmallIconImage
Added in API level 23.
Set the small icon, which will be used to represent the notification in the status bar and content view.
SmallSystemIcon
Set the small icon resource, which will be used to represent the notification in the status bar.
Text
Set the second line of text in the platform notification template. The text can be formatted with HTML tags. Which HTML tags can be used varies depending on the implementation of the Android system. There are hints at Mark Murphy's Technical Stuff or Daniel Lew's Coding Thoughts.
Title
Set the first line of text in the platform notification template. The text can be formatted with HTML tags. Which HTML tags can be used varies depending on the implementation of the Android system. There are hints at Mark Murphy's Technical Stuff or Daniel Lew's Coding Thoughts.
VersionSDK
The SDK version of the software currently running on this hardware device. This value never changes while a device is booted, but it may increase when the hardware manufacturer provides an OTA update.
UseMediaStyle
Added in API level  21.
Media are diplayed (Create a notification with media controls). Action buttons and BigPicture then no longer have any effect / function.
Added in API level  24.
Colorized and Color define the background color of the notification (DecoratedMediaCustomViewStyle).
When
Adds a timestamp pertaining to the notification (usually the time the event occurred).
WhenChronometerCountDown
Added in API level 24.
Sets the Chronometer to count down instead of counting up.
WhenEnabled
Added in API level 17.
Control whether the timestamp is shown in the content view.
WhenUsesChronometer
Added in API level 16.
Shows the Notification.when field as a stopwatch.

Functions

AddActionButton (Title, UrsIntentObject)
Added in API level 16.
Adds action buttons to the notification. Up to three buttons are supported. The text can be formatted with HTML tags. Which HTML tags can be used varies depending on the implementation of the Android system. There are hints at Mark Murphy's Technical Stuff or Daniel Lew's Coding Thoughts.

If the object specified in the UrsIntentObject parameter is not of the UrsIntent type, the notification is not created and Screen.ErrorOccurred is triggered with ErrorNumber 17006.

If the Title parameter is empty, the button is not added and Screen.ErrorOccurred is triggered with ErrorNumber 17010.
AddMediaButton (Title, Icon, ShowInCampactView, UrsIntentObject)
Ab API Level 21.
Adds media buttons to the notification. The text can be formatted with HTML tags. Which HTML tags can be used varies depending on the implementation of the Android system. There are hints at Mark Murphy's Technical Stuff or Daniel Lew's Coding Thoughts.

Icon is the name of an asset grafic file (Media section at App Inventor ). On some devices there is an additional compact representation of the notification. ShowInCampactView defines whether the button is also displayed in the compact display. .

If the object specified in the UrsIntentObject parameter is not of the UrsIntent type, the notification is not created and Screen.ErrorOccurred is triggered with ErrorNumber 17006.

If the Title parameter is empty, the button is not added and Screen.ErrorOccurred is triggered with ErrorNumber 17010.

If the Icon parameter is empty, the button is not added and Screen.ErrorOccurred is triggered with ErrorNumber 17011.
Cancel()
Cancels the notification.
Create (UrsChannelObject, UrsIntentObject)
Creates and opens a notification. Identical with UrsAI2NotificationChannel.CreateNotification.

If the object specified in the UrsChannelObject parameter is not of the UrsAI2NotificationChannel type, the notification is not created and Screen.ErrorOccurred is triggered with ErrorNumber 17001.

If the object specified in the UrsIntentObject parameter is not of the UrsIntent type, the notification is not created and Screen.ErrorOccurred is triggered with ErrorNumber 17006.
RemoveActionButtons ()
Removes the action buttons from the notifiaction.
RemoveMediaButtons ()
Removes the media buttons from the notifiaction.
RemoveOnDestroyAction ()
Removes the notification that is shown when the app is closed (see SetOnDestroyAction).
RemoveProgressBar ()
Removes a progress bar from the notification. The notification has to be created with UrsNotificationChannel.CreateProgressNotification.

If the notification has not been created yet the function has no affect and Screen.ErrorOccurred is triggered with ErrorNumber 17009.
RemoveProgressBarEx (Title, Text)
Removes a progress bar from the notification and updates Title and Text property. The notification has to be created with UrsNotificationChannel.CreateProgressNotification.

If the notification has not been created yet the function has no affect and Screen.ErrorOccurred is triggered with ErrorNumber 17009.
SetOnDestroyAction (UrsChannelObject, UrsNotificationObject, UrsIntentObject)
Defines a notification that is shown when the app is closed.

If the object specified in the UrsChannelObject parameter is not of the UrsAI2NotificationChannel type, the notification is not created and Screen.ErrorOccurred is triggered with ErrorNumber 17001.

If the object specified in the UrsNotificationObject parameter is not of the UrsNotification type, the notification is not created and Screen.ErrorOccurred is triggered with ErrorNumber 17005.

If the object specified in the UrsIntentObject parameter is not of the UrsIntent type, the notification is not created and Screen.ErrorOccurred is triggered with ErrorNumber 17006.
SetProgress (CurrentProgress)
Added in API level 16.
Set the progress this notification represents. The notification has to be created with UrsNotificationChannel.CreateProgressNotification.

If the notification has not been created yet the function has no affect and Screen.ErrorOccurred is triggered with ErrorNumber 17009.
SetProgressEx (Title, Text, CurrentProgress)
Added in API level 16.
Set the progress this notification represents and updates Title and Text property. The notification has to be created with UrsNotificationChannel.CreateProgressNotification.

If the notification has not been created yet the function has no affect and Screen.ErrorOccurred is triggered with ErrorNumber 17009.

Events

OnClick(IntentID)
If an UrsIntent with ActionType Event is specified for the notification's event or for an action button, this event is raised when the user tapps the notification or the button.
UserCanceled()
The notification was canceled by the user.