From Android 4.1 (Jelly Bean, api level 16), the notifications displayed in the list of device notifications can be "expanded" in order to display more content (image, multi-line text, etc.).
The displayed notifications are automatically collapsed or expanded by the system according to the available space in the list. However, the user has the ability to collapse or expand a notification by performing a swipe gesture to the top (collapse) or to the bottom (expand) with two fingers.
The notificationFormat type is used to describe the display format of a notification when this one is expanded. The characteristics of this display format can be defined and modified by several WLanguage properties.
To associate a format with a notification, all you have to do is use the ..Format
property of Notification
- The format will be ignored if the notification is displayed on a device running a version earlier than Android 4.1.
- See Declaring a variable for more details.
n is Notification
n..Title = "Photo saved"
n..Message = "Date of snapshot: 07/18/2014 19:45"
n..LargeIcon = "photo.png"
n..SecondaryMessage = "desert.png"
n..Format..Type = notifImageFormat
n..Format..Content = fCurrentDir + "photos/desert.png"
Properties specific to the description of notificationFormat variables
The following properties can be used to handle a notification format:
|Property name||Type used||Effect|
|Content||Character string||Content of notification to display. The value of this property depends on the type of format used (..Type property). |
- If ..Type is set to notifImageFormat, ..Content corresponds to the path of the image to display.
- If ..Type is set to notifListFormat, ..Content corresponds to the elements that will be displayed in the list, separated by CR characters (Carriage Return). You have the ability to display up to 5 elements in the list. The additional elements will be ignored.
- If ..Type is set to notifTextFormat, ..Content corresponds to the multiline text to display. If the specified text is too long, it may be truncated when it is displayed.
|LargeIcon||Character string||Path of image corresponding to the large icon associated with the notification. This icon will be displayed on the left of notification title and message. |
If this property is not filled, the large icon of notification will be identical to the one used when the notification is collapsed.
This property is taken into account only if ..Type corresponds to the notifImageFormat constant.
|SecondaryMessage||Character string||Secondary message of notification. If this property is not filled, the secondary message of notification will be identical to the one used when the notification is collapsed.|
|Title||Character string||Title of notification when this one is expanded. If this property is not filled, the notification title will be identical to the one used when the notification is collapsed.|
|Type||Integer constant||Type of format that will be applied to the notification when this one is expanded: |
- notifImageFormat: Display an image.
- notifListFormat: Display a list of elements.
- notifTextFormat (default value): Display a multiline text.
: These properties can be handled by using one of the following syntaxes:
- <Variable name>..<Property name>
- <Variable name>.<Property name>
To reinitialize the content of a notificationFormat
variable, you have the ability to use VariableReset