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, multiline 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 describes the display format of a notification when it is expanded. The characteristics of the display format can be defined and changed using different WLanguage properties.
To associate a format with a notification, use the Format
property of the Notification
- The format will be ignored if the notification is displayed on a device running a version earlier than Android 4.1.
- For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
n is Notification
n.Title = "Photo saved"
n.Message = "Date taken: 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 the Type property is set to notifImageFormat, the Content property corresponds to the path of the image to be displayed.
- If the Type property is set to notifListFormat, the Content property corresponds to the elements to be displayed in the list, separated by carriage returns (CR). You have the ability to display up to 5 elements in the list. The additional elements will be ignored.
- If the Type property is set to notifTextFormat, the Content property corresponds to the multiline text to be displayed. 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 to the left of the 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 the Type property is set to notifImageFormat.
|SecondaryMessage||Character string||Secondary message of the 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.
You can use VariableReset
to reset the content of the notificationFormat