- Using the Notification type
- Example of notification in Android
- Properties specific to the description of Notification variables for a local notification
- Properties specific to the description of Notification variables for a push notification
- Functions that use the Notification type
- Reinitialization
Notification (Type of variable) In french: Notification
The Notification type is used to handle The characteristics of this notification can be defined and modified using different WLanguage properties. Remark: See Declaring a variable for more details on the declaration of this type of variable and the use of WLanguage properties. Versions 19 and later New in version 19
// Simple notification // -------------------- notif is Notification notif.Title = "New incoming message" notif.Message = "Click here to display the message" NotifAdd(notif)
Versions 20 and later New in version 20 Remarks Using the Notification type The Notification type is used to manage the local notifications and the push notifications. This help page presents: Example of notification in Android The different elements of this notification can be configured by the Notification type: Versions 20 and later1. Large notification icon ( LargeIcon property). New in version 201. Large notification icon ( LargeIcon property). 1. Large notification icon (LargeIcon property).- 2. Notification title (Title property).
- 3. Notification message (Message property).
Versions 20 and later4. Secondary message ( SecondaryMessage property). New in version 204. Secondary message ( SecondaryMessage property). 4. Secondary message (SecondaryMessage property). Versions 20 and later5. Time for receiving the notification ( Chronometer property). New in version 205. Time for receiving the notification ( Chronometer property). 5. Time for receiving the notification (Chronometer property).- 6. Application icon (Icon property).
Versions 20 and later7. Additional actions of the notification ( AdditionalAction property). New in version 207. Additional actions of the notification ( AdditionalAction property). 7. Additional actions of the notification (AdditionalAction property).
Versions 19 and laterProperties specific to the description of Notification variables for a push notification The following properties can be used to handle a notification: | | | Property name | Type used | Effect |
---|
Versions 18 and laterActivateApplication New in version 18ActivateApplication ActivateApplication | Boolean | - True if the application must be displayed in the foreground during the click on the notification.
- False (default value) otherwise.
| DisplayLED | Boolean | - True if the LED of the device must be switched on when the notification is displayed,
- False (default value) otherwise.
The color of the LED and the frequency of lighting can change from a device to another one. Versions 24 and later New in version 24 | Versions 19 and laterBadge New in version 19Badge Badge | Integer | Number displayed by the icon of the application. | Versions 24 and laterCategory New in version 24Category Category | notificationCategory | Category associated with the notification. Notification categories are available from Android 8.0 (API level 26). If the application runs on an older version, the Category property will be ignored. It is recommended to always associate a category with a notification- If the category does not exist when the notification is added, it will be automatically created,
- If the category already exists for the application, the notification will be associated with it.
- If no category has been specified, the notification will be automatically associated to a preset category according to its level of priority. These are the preset categories :
- Min. priority
- Low priority
- Standard priority
- High priority
- Max. priority
The preset category will be created when adding a notification without category for the first time with the corresponding level of priority, and it will use the visual and audio parameters of this notification (vibration, sound, led indicator, etc.). These parameters can later be modified by the end user. If the predefined category already exists, the notification will inherit its properties.
| Versions 20 and laterStopwatch New in version 20Stopwatch Stopwatch | Boolean | - True to display a stopwatch instead of the notification time. The stopwatch will be automatically started when receiving the notification and its display will be automatically refreshed.
- False (default value) to avoid displaying a stopwatch. The time associated with the notification will be displayed.
Caution: Displaying a stopwatch in the notifications is available from Android 4.1 (Jelly Bean, api level 16). On the devices running an earlier version, the stopwatch will be ignored and the time associated with the notification will be displayed. | Versions 19 and laterContent New in version 19Content Content | Character string | Custom data of notification. This data is not displayed in the notification. | ColorLED | Integer | Color of LED when displaying the notification. The value of this property is taken into account only if DisplayLED is set to True. The display color of the LED is green by default. This color can correspond to: - an RGB color (returned by RGB),
- an HSL component of the color (returned by HSL),
- a preset color of WLanguage.Caution: Some devices do not allow you to modify the LED color or they do not propose all the colors. A default color will be used if the specified color is not supported by the device.
Versions 24 and later New in version 24 | Versions 20 and laterFormat New in version 20Format Format | notificationFormat | Display format of the notification when this one is expanded. Caution: Displaying the notifications in "expanded" mode is available from Android 4.1 (Jelly Bean, api level 16). The display format will be ignored on the devices running an earlier version. | Versions 20 and laterLargeIcon New in version 20LargeIcon 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 no image is specified, the icon specified by the Icon property will be used. If this one is not specified, the icon of the application will be used. Caution: Displaying this image in the notifications is available for the devices running Android 3.0 (Honeycomb, api level 11) or later. This image will be ignored on the devices running an earlier version. | Versions 19 and laterGroup New in version 19Group Group | Character string | Name of the group to which the push notification is associated. If several push notifications belonging to the same group are sent with an identical content while the destination device cannot be reached, only the last notification of the group will be sent when the device can be contacted again by the Google Cloud Messaging server. | Icon | Character string | Path of the image corresponding to the icon associated with the notification. The icon of the application will be used if no icon is specified. | Versions 19 and laterActionLabel New in version 19ActionLabel ActionLabel | Character string | Caption for the action button of the notification. | Versions 20 and laterLocal New in version 20Local Local | Boolean | - True if the notification is local to the device that receives it: this notification must not be transmitted to the objects operating in Android Wear connected to the device (a watch for example).
- False (default value) if the notification must be automatically transmitted to the connected objects.
| Message | Character string | Message of the notification. | Versions 20 and laterSecondaryMessage New in version 20SecondaryMessage SecondaryMessage | Character string | Secondary message displayed below the main message of the notification. Caution: Displaying a secondary message in the notifications is available from Android 4.1 (Jelly Bean, api level 16). The secondary message will be ignored on the devices running an earlier version. | Versions 20 and laterPriority New in version 20Priority Priority | Integer constant | Priority of notification. Changing the priority of a notification is used to modify its display position in the list of notifications on the device in order for the user to see the most important notifications first. A notification with a high priority will be displayed at the top of the list while a notification with a low priority will be displayed at the end of the list. In some situations, a notification with a low priority can be hidden to the user if other notifications with higher priorities are received. This property can take the following values : - notifMaxPriority : maximum priority (example: incoming call).
- notifHighPriority : high priority (example : receiving an urgent email).
- notifDefaultPriority (default value): standard priority (example : receiving an SMS).
- notifLowPriority : low priority (example : notification for update).
- notifMinPriority: minimum priority (example : commercial information).
Modifying the priorities of notifications is available from Android 4.1 (Jelly Bean, api level 16). The priority will be ignored on the devices running an earlier version: all the notifications have the same priority. Versions 24 and later New in version 24 | Sound | Character string | Path of the sound file to play when displaying the notification. To play the default sound of notifications, use the notifDefaultSound constant. This default sound can change from a device to another one. You have the ability to play a sound issued from an audio file included in the application (via the generation wizard): to do so, specify the name of the file and its extension. To associate no sound with the notification, use an empty string ("", default value). Versions 24 and later New in version 24 | Versions 18 and laterDeletable New in version 18Deletable Deletable | Boolean | - True (default value) if the notification can be deleted by the user,
- False otherwise.
If this property is set to False, the notification will be erased in the following cases: - Closing the application.
- Call to function NotifDelete.
- If the WLanguage procedure run on the click (ActionClick property) returned True or returned no value.
| DropDownText | Character string | Drop-down text briefly displayed in the system bar when displaying the notification. No message will be displayed if this property corresponds to an empty string ("", default value). | Title | Character string | Title of the notification. The name of the application will be used if no title is specified. | Vibration | Boolean | - True if the device must vibrate when displaying the notification,
- False (default value) otherwise.
Remark: The duration and the power of vibrations can change from a device to another one. Versions 24 and later New in version 24 |
New in version 19Properties specific to the description of Notification variables for a push notification The following properties can be used to handle a notification: | | | Property name | Type used | Effect |
---|
Versions 18 and laterActivateApplication New in version 18ActivateApplication ActivateApplication | Boolean | - True if the application must be displayed in the foreground during the click on the notification.
- False (default value) otherwise.
| DisplayLED | Boolean | - True if the LED of the device must be switched on when the notification is displayed,
- False (default value) otherwise.
The color of the LED and the frequency of lighting can change from a device to another one. Versions 24 and later New in version 24 | Versions 19 and laterBadge New in version 19Badge Badge | Integer | Number displayed by the icon of the application. | Versions 24 and laterCategory New in version 24Category Category | notificationCategory | Category associated with the notification. Notification categories are available from Android 8.0 (API level 26). If the application runs on an older version, the Category property will be ignored. It is recommended to always associate a category with a notification- If the category does not exist when the notification is added, it will be automatically created,
- If the category already exists for the application, the notification will be associated with it.
- If no category has been specified, the notification will be automatically associated to a preset category according to its level of priority. These are the preset categories :
- Min. priority
- Low priority
- Standard priority
- High priority
- Max. priority
The preset category will be created when adding a notification without category for the first time with the corresponding level of priority, and it will use the visual and audio parameters of this notification (vibration, sound, led indicator, etc.). These parameters can later be modified by the end user. If the predefined category already exists, the notification will inherit its properties.
| Versions 20 and laterStopwatch New in version 20Stopwatch Stopwatch | Boolean | - True to display a stopwatch instead of the notification time. The stopwatch will be automatically started when receiving the notification and its display will be automatically refreshed.
- False (default value) to avoid displaying a stopwatch. The time associated with the notification will be displayed.
Caution: Displaying a stopwatch in the notifications is available from Android 4.1 (Jelly Bean, api level 16). On the devices running an earlier version, the stopwatch will be ignored and the time associated with the notification will be displayed. | Versions 19 and laterContent New in version 19Content Content | Character string | Custom data of notification. This data is not displayed in the notification. | ColorLED | Integer | Color of LED when displaying the notification. The value of this property is taken into account only if DisplayLED is set to True. The display color of the LED is green by default. This color can correspond to: - an RGB color (returned by RGB),
- an HSL component of the color (returned by HSL),
- a preset color of WLanguage.Caution: Some devices do not allow you to modify the LED color or they do not propose all the colors. A default color will be used if the specified color is not supported by the device.
Versions 24 and later New in version 24 | Versions 20 and laterFormat New in version 20Format Format | notificationFormat | Display format of the notification when this one is expanded. Caution: Displaying the notifications in "expanded" mode is available from Android 4.1 (Jelly Bean, api level 16). The display format will be ignored on the devices running an earlier version. | Versions 20 and laterLargeIcon New in version 20LargeIcon 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 no image is specified, the icon specified by the Icon property will be used. If this one is not specified, the icon of the application will be used. Caution: Displaying this image in the notifications is available for the devices running Android 3.0 (Honeycomb, api level 11) or later. This image will be ignored on the devices running an earlier version. | Versions 19 and laterGroup New in version 19Group Group | Character string | Name of the group to which the push notification is associated. If several push notifications belonging to the same group are sent with an identical content while the destination device cannot be reached, only the last notification of the group will be sent when the device can be contacted again by the Google Cloud Messaging server. | Icon | Character string | Path of the image corresponding to the icon associated with the notification. The icon of the application will be used if no icon is specified. | Versions 19 and laterActionLabel New in version 19ActionLabel ActionLabel | Character string | Caption for the action button of the notification. | Versions 20 and laterLocal New in version 20Local Local | Boolean | - True if the notification is local to the device that receives it: this notification must not be transmitted to the objects operating in Android Wear connected to the device (a watch for example).
- False (default value) if the notification must be automatically transmitted to the connected objects.
| Message | Character string | Message of the notification. | Versions 20 and laterSecondaryMessage New in version 20SecondaryMessage SecondaryMessage | Character string | Secondary message displayed below the main message of the notification. Caution: Displaying a secondary message in the notifications is available from Android 4.1 (Jelly Bean, api level 16). The secondary message will be ignored on the devices running an earlier version. | Versions 20 and laterPriority New in version 20Priority Priority | Integer constant | Priority of notification. Changing the priority of a notification is used to modify its display position in the list of notifications on the device in order for the user to see the most important notifications first. A notification with a high priority will be displayed at the top of the list while a notification with a low priority will be displayed at the end of the list. In some situations, a notification with a low priority can be hidden to the user if other notifications with higher priorities are received. This property can take the following values : - notifMaxPriority : maximum priority (example: incoming call).
- notifHighPriority : high priority (example : receiving an urgent email).
- notifDefaultPriority (default value): standard priority (example : receiving an SMS).
- notifLowPriority : low priority (example : notification for update).
- notifMinPriority: minimum priority (example : commercial information).
Modifying the priorities of notifications is available from Android 4.1 (Jelly Bean, api level 16). The priority will be ignored on the devices running an earlier version: all the notifications have the same priority. Versions 24 and later New in version 24 | Sound | Character string | Path of the sound file to play when displaying the notification. To play the default sound of notifications, use the notifDefaultSound constant. This default sound can change from a device to another one. You have the ability to play a sound issued from an audio file included in the application (via the generation wizard): to do so, specify the name of the file and its extension. To associate no sound with the notification, use an empty string ("", default value). Versions 24 and later New in version 24 | Versions 18 and laterDeletable New in version 18Deletable Deletable | Boolean | - True (default value) if the notification can be deleted by the user,
- False otherwise.
If this property is set to False, the notification will be erased in the following cases: - Closing the application.
- Call to function NotifDelete.
- If the WLanguage procedure run on the click (ActionClick property) returned True or returned no value.
| DropDownText | Character string | Drop-down text briefly displayed in the system bar when displaying the notification. No message will be displayed if this property corresponds to an empty string ("", default value). | Title | Character string | Title of the notification. The name of the application will be used if no title is specified. | Vibration | Boolean | - True if the device must vibrate when displaying the notification,
- False (default value) otherwise.
Remark: The duration and the power of vibrations can change from a device to another one. Versions 24 and later New in version 24 |
Properties specific to the description of Notification variables for a push notification The following properties can be used to handle a notification: | | | Property name | Type used | Effect |
---|
Versions 18 and laterActivateApplication New in version 18ActivateApplication ActivateApplication | Boolean | - True if the application must be displayed in the foreground during the click on the notification.
- False (default value) otherwise.
| DisplayLED | Boolean | - True if the LED of the device must be switched on when the notification is displayed,
- False (default value) otherwise.
The color of the LED and the frequency of lighting can change from a device to another one. Versions 24 and later New in version 24 | Versions 19 and laterBadge New in version 19Badge Badge | Integer | Number displayed by the icon of the application. | Versions 24 and laterCategory New in version 24Category Category | notificationCategory | Category associated with the notification. Notification categories are available from Android 8.0 (API level 26). If the application runs on an older version, the Category property will be ignored. It is recommended to always associate a category with a notification- If the category does not exist when the notification is added, it will be automatically created,
- If the category already exists for the application, the notification will be associated with it.
- If no category has been specified, the notification will be automatically associated to a preset category according to its level of priority. These are the preset categories :
- Min. priority
- Low priority
- Standard priority
- High priority
- Max. priority
The preset category will be created when adding a notification without category for the first time with the corresponding level of priority, and it will use the visual and audio parameters of this notification (vibration, sound, led indicator, etc.). These parameters can later be modified by the end user. If the predefined category already exists, the notification will inherit its properties.
| Versions 20 and laterStopwatch New in version 20Stopwatch Stopwatch | Boolean | - True to display a stopwatch instead of the notification time. The stopwatch will be automatically started when receiving the notification and its display will be automatically refreshed.
- False (default value) to avoid displaying a stopwatch. The time associated with the notification will be displayed.
Caution: Displaying a stopwatch in the notifications is available from Android 4.1 (Jelly Bean, api level 16). On the devices running an earlier version, the stopwatch will be ignored and the time associated with the notification will be displayed. | Versions 19 and laterContent New in version 19Content Content | Character string | Custom data of notification. This data is not displayed in the notification. | ColorLED | Integer | Color of LED when displaying the notification. The value of this property is taken into account only if DisplayLED is set to True. The display color of the LED is green by default. This color can correspond to: - an RGB color (returned by RGB),
- an HSL component of the color (returned by HSL),
- a preset color of WLanguage.Caution: Some devices do not allow you to modify the LED color or they do not propose all the colors. A default color will be used if the specified color is not supported by the device.
Versions 24 and later New in version 24 | Versions 20 and laterFormat New in version 20Format Format | notificationFormat | Display format of the notification when this one is expanded. Caution: Displaying the notifications in "expanded" mode is available from Android 4.1 (Jelly Bean, api level 16). The display format will be ignored on the devices running an earlier version. | Versions 20 and laterLargeIcon New in version 20LargeIcon 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 no image is specified, the icon specified by the Icon property will be used. If this one is not specified, the icon of the application will be used. Caution: Displaying this image in the notifications is available for the devices running Android 3.0 (Honeycomb, api level 11) or later. This image will be ignored on the devices running an earlier version. | Versions 19 and laterGroup New in version 19Group Group | Character string | Name of the group to which the push notification is associated. If several push notifications belonging to the same group are sent with an identical content while the destination device cannot be reached, only the last notification of the group will be sent when the device can be contacted again by the Google Cloud Messaging server. | Icon | Character string | Path of the image corresponding to the icon associated with the notification. The icon of the application will be used if no icon is specified. | Versions 19 and laterActionLabel New in version 19ActionLabel ActionLabel | Character string | Caption for the action button of the notification. | Versions 20 and laterLocal New in version 20Local Local | Boolean | - True if the notification is local to the device that receives it: this notification must not be transmitted to the objects operating in Android Wear connected to the device (a watch for example).
- False (default value) if the notification must be automatically transmitted to the connected objects.
| Message | Character string | Message of the notification. | Versions 20 and laterSecondaryMessage New in version 20SecondaryMessage SecondaryMessage | Character string | Secondary message displayed below the main message of the notification. Caution: Displaying a secondary message in the notifications is available from Android 4.1 (Jelly Bean, api level 16). The secondary message will be ignored on the devices running an earlier version. | Versions 20 and laterPriority New in version 20Priority Priority | Integer constant | Priority of notification. Changing the priority of a notification is used to modify its display position in the list of notifications on the device in order for the user to see the most important notifications first. A notification with a high priority will be displayed at the top of the list while a notification with a low priority will be displayed at the end of the list. In some situations, a notification with a low priority can be hidden to the user if other notifications with higher priorities are received. This property can take the following values : - notifMaxPriority : maximum priority (example: incoming call).
- notifHighPriority : high priority (example : receiving an urgent email).
- notifDefaultPriority (default value): standard priority (example : receiving an SMS).
- notifLowPriority : low priority (example : notification for update).
- notifMinPriority: minimum priority (example : commercial information).
Modifying the priorities of notifications is available from Android 4.1 (Jelly Bean, api level 16). The priority will be ignored on the devices running an earlier version: all the notifications have the same priority. Versions 24 and later New in version 24 | Sound | Character string | Path of the sound file to play when displaying the notification. To play the default sound of notifications, use the notifDefaultSound constant. This default sound can change from a device to another one. You have the ability to play a sound issued from an audio file included in the application (via the generation wizard): to do so, specify the name of the file and its extension. To associate no sound with the notification, use an empty string ("", default value). Versions 24 and later New in version 24 | Versions 18 and laterDeletable New in version 18Deletable Deletable | Boolean | - True (default value) if the notification can be deleted by the user,
- False otherwise.
If this property is set to False, the notification will be erased in the following cases: - Closing the application.
- Call to function NotifDelete.
- If the WLanguage procedure run on the click (ActionClick property) returned True or returned no value.
| DropDownText | Character string | Drop-down text briefly displayed in the system bar when displaying the notification. No message will be displayed if this property corresponds to an empty string ("", default value). | Title | Character string | Title of the notification. The name of the application will be used if no title is specified. | Vibration | Boolean | - True if the device must vibrate when displaying the notification,
- False (default value) otherwise.
Remark: The duration and the power of vibrations can change from a device to another one. Versions 24 and later New in version 24 |
Functions that use the Notification type The following functions handle the Notification variables for a local notification:
| | NotifAdd | Adds a notification into the system bar of device (Android) or into the notification center (iOS). | NotifDelete | Deletes a notification displayed in the system bar of the device. | NotifModify | Modifies a notification currently displayed in the system bar of the device. | NotifPushSend | Sends a push notification to a mobile device (iOS or Android). | ThreadPersistent | Makes a thread persistent. |
Reinitialization You can use VariableReset to reinitialize the content of a Notification variable.
Related Examples:
|
Training: WM Push
[ + ] This example shows how to receive Push notifications. It calls the PushNotifActive function and returns the identifier to "WD Push Server", which stores it. Then, the "Send Push" example reads this identifier and sends Push notifications to this example.
|
|
Training: WD_Push_Server
[ + ] This example is a webservice used to store the identifiers required to sent Push notifications to mobile devices. The "WM Push" application stores the Push identifiers in the database of this example. The "WD Send Push" example then reads these identifiers in order to send the notifications.
|
|
Training: Send Push
[ + ] This example allows you to send push notifications to Android and iOS devices. It retrieves the identifiers of the mobile devices in the HFSQL database of the "WD Push Server" example, then sends the notifications via the NotifPushSend function.
|
|
Cross-platform examples (WINDEV Mobile): WM_System
[ + ] This application is an example of some of the features of WINDEV Mobile available for Android/iOS. The following system functions are used: - NFC - Multimedia control - Brightness - Volume - Wi-Fi - Bluetooth - Toast - Compass - Accelerometer - Camera control - LED - Vibration - Notifications - Drawing functions - Internet
|
This page is also available for…
|
|
|