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 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 using different WLanguage properties.
To associate a format with an Notification, you just have to use the Property Format
of type 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 on the declaration of this type of variable and the use of WLanguage properties.
n is Notification
n.Title = "Photo enregistrée"
n.Message = "Date de la prise de vue: 18/07/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 (Property Type).. |
- If Property Type is notifImageFormat, then Property Content is path of the Image to be displayed.
- If Property Type is notifListFormat, then Property Content is the items 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 Property Type is notifTextFormat, then Property Content is 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 set, the large Notification icon will be the same as the one used when the Notification is rolled up.
This property is only taken into account if the property Type matches the constant notifImageFormat.
|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: Displaying a list of items.
- notifTextFormat (default value): Display a multiline text.
To reset the content of a variable of type notificationFormat
, it is possible to use the function VariableReset