AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Funciones específicas para móviles / Funciones de teléfono
  • Using the Notification type
  • Example of notification in Android
  • Properties specific to Notification variables for a local notification
  • Properties specific to Notification variables for a push notification
  • Functions that use the Notification type
  • Reinitialization
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Otros
Procedimientos almacenados
The Notification type is used to handle
  • AndroidiPhone/iPadIOS Widget the local notifications.
  • the push notifications.
You can define and change the characteristics of this notification using different WLanguage properties.
Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
Ejemplo
// Notification simple
// --------------------
notif is Notification
notif.Title = "Nouveau message reçu"
notif.Message = "Cliquez pour afficher le message"
NotifAdd(notif)
Android
// Notification avec deux actions supplémentaires
n is Notification
n.Title = "Nouveau message"
n.Message = "Commande n°54781-4551"
n.SecondaryMessage = "client@societe.com"
n.LargeIcon = "enveloppe.png"
n.AdditionalAction[1].LibelléAction = "Répondre"
n.AdditionalAction[1].Icone = "repondre.png"
n.AdditionalAction[1].ActionClic = "procRepondre"
n.AdditionalAction[2].LibelléAction = "Supprimer"
n.AdditionalAction[2].Icone = "supprimer.png"
n.AdditionalAction[2].ActionClic = "procSupprimer"
NotifAdd(n)

// Notification avec définition d'un format de notification
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.Format  = notifImageFormat
n.Format.Contenu = fCurrentDir + "photos/desert.png"
NotifAdd(n)
Observaciones

Example of notification in Android

The different elements of this notification can be configured by the Notification type:
  • 1. Large notification icon (LargeIcon property).
  • 2. Notification title (Title property).
  • 3. Notification message (Message property).
  • 4. Secondary message (SecondaryMessage property).
  • 5. Time for receiving the notification (Chronometer property).
  • 6. Application icon (Icon property).
  • 7. Additional actions of the notification (AdditionalAction property).
AndroidiPhone/iPadIOS Widget

Properties specific to Notification variables for a local notification

The following properties can be used to handle a notification:
Property nameType usedEffect
ActionClickValue or name of procedureName of WLanguage procedure called when the user clicks the notification in the drop-down list of notifications displayed on the device.
This procedure has the following format:
PROCEDURE <Nom de la procédure> (<Notification>)
where <Notification> is a Notification variable corresponding to the notification selected by the user.
If the WLanguage procedure returns True or if it returns no value:
  • Android the notification will be automatically deleted from the system bar.
  • iPhone/iPadIOS Widget the notification is not deleted from the system bar.
If the procedure returns False, the notification will still be displayed.
If the ActionClick property is set to an empty string (""), there will be no on-click action and the notification will be automatically deleted afterwards.
It is recommended to use global procedures. If the procedure is a local procedure, the name of this procedure must be prefixed by the full name of object to which the procedure belongs. For example, for a procedure local to a window: "WIN_Window1.MyProcedure".
ActionLabelCharacter stringCaption for the action button of the notification.
Android This property is not available.
ActivateApplicationBoolean
  • True if the application must be displayed in the foreground during the click on the notification.
  • False (default value) otherwise.
iPhone/iPadIOS Widget This property is not available.
ActivationDateTimeDateTime or character stringDate and time when the notification must be sent. The notification is sent immediately be default.
Android This property is not available.
AdditionalActionArray of notificationAction variablesAdditional actions associated with the notification.
Caution: The additional actions of notifications are available from Android 4.1 (Jelly Bean, api level 16). The additional actions will be ignored on the devices running an earlier version.
iPhone/iPadIOS Widget This property is not available.
AlertOnceBooleanAllows managing the alert in case the notification is already displayed:
  • True to not play the notification sound or vibration if the notification is already displayed,
  • False (default value) otherwise.
iPhone/iPadIOS Widget This property is not available.
BadgeIntegerNumber displayed by the icon of the application.
Android On Android, this property is supported from version 8.0.
CategorynotificationCategoryCategory 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.
iPhone/iPadIOS Widget This property is not available.
ColorLEDIntegerColor 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:
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.
Android Management of notification categories (from Android 8.0):
  • If a category was specified when the notification was added (Category property), this property is ignored. The notification will use the corresponding property of the category it is associated with.
  • If no category was specified when the notification was added (Category property), the notification will be associated to the preset category corresponding to the value of the Priority property.
    • If the preset category exists, this property is ignored: the notification will use the corresponding property of the preset category it is associated with.
    • If the preset category does not exist yet, this property is used to define the properties to create one.
iPhone/iPadIOS Widget This property is not available.
ContentCharacter stringCustom data of notification. This data is not displayed in the notification.
DeletableBoolean
  • 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:
  • The application is closed.
  • Calling the NotifDelete function .
  • If the WLanguage procedure run on the click (ActionClick property) returned True or returned no value.
iPhone/iPadIOS Widget This property is not available.
DisplayLEDBoolean
  • 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.
Android Management of notification categories (from Android 8.0):
  • If a category was specified when the notification was added (Category property), this property is ignored. The notification will use the corresponding property of the category it is associated with.
  • If no category was specified when the notification was added (Category property), the notification will be associated to the preset category corresponding to the value of the Priority property.
    • If the preset category exists, this property is ignored: the notification will use the corresponding property of the preset category it is associated with.
    • If the preset category does not exist yet, this property is used to define the properties to create one.
iPhone/iPadIOS Widget This property is not available.
DropDownTextCharacter stringDrop-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).
iPhone/iPadIOS Widget This property is not available.
FormatnotificationFormatDisplay 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.
iPhone/iPadIOS Widget This property is not available.
IconCharacter stringPath of the image corresponding to the icon associated with the notification.
The icon of the application will be used if no icon is specified.
iPhone/iPadIOS Widget Remarks:
  • The file used must be found in bundle de of the application. The specified path must be a relative path.
  • The image will be displayed only if the application is not in the foreground (which means if the application is not enabled).
LargeIconCharacter stringPath 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 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 from Android 3.0 (Honeycomb, api level 11). This image will be ignored on the devices running an earlier version.
iPhone/iPadIOS Widget This property is not available.
LocalBoolean
  • 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.
iPhone/iPadIOS Widget This property is not available.
MessageCharacter stringMessage of the notification.
PriorityInteger constantPriority 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.
Android Management of notification categories (from Android 8.0):
  • If a category was specified when the notification was added (Category property), this property is ignored. The notification will use the corresponding property of the category it is associated with.
  • If no category was specified when the notification was added (Category property), the notification will be associated to the preset category corresponding to the value of the Priority property.
    • If the preset category exists, this property is ignored: the notification will use the corresponding property of the preset category it is associated with.
    • If the preset category does not exist yet, this property is used to define the properties to create one.
iPhone/iPadIOS Widget This property is not available.
ProgressBarMaxIntegerMaximum value of the progress bar displayed in the notification.
The value will be taken into account only if the ProgressBarType property corresponds to the notifStandardProgressBar constant.
This feature is available from Android 3.0.
iPhone/iPadIOS Widget This property is not available.
ProgressBarTypeInteger constantType of progress bar displayed in the notification:
  • notifInfiniteProgressBar: an infinite progress bar will be displayed in the notification.
  • notifNoProgressBar (default value): no progress bar will be displayed in the notification.
  • notifStandardProgressBar: a standard progress bar will be displayed in the notification. The value and the bound of this progress bar can be defined by .ProgressBarMax and .ProgressBarValue respectively.
This feature is available from Android 3.0.
iPhone/iPadIOS Widget This property is not available.
ProgressBarValueIntegerCurrent value of the progress bar displayed in the notification.
The value will be taken into account only if the ProgressBarType property corresponds to the notifStandardProgressBar constant.
This feature is available from Android 3.0.
iPhone/iPadIOS Widget This property is not available.
SecondaryMessageCharacter stringSecondary 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.
iPhone/iPadIOS Widget This property is not available.
SoundCharacter stringPath 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).
Android Management of notification categories (from Android 8.0):
  • If a category was specified when the notification was added (Category property), this property is ignored. The notification will use the corresponding property of the category it is associated with.
  • If no category was specified when the notification was added (Category property), the notification will be associated to the preset category corresponding to the value of the Priority property.
    • If the preset category exists, this property is ignored: the notification will use the corresponding property of the preset category it is associated with.
    • If the preset category does not exist yet, this property is used to define the properties to create one.
iPhone/iPadIOS Widget Remarks:
  • The file used must be found in bundle de of the application. The specified path must be a relative path.
  • The file used must be in "aac" format and its duration must not exceed 30 seconds.
  • The sound will be played only if the application is not in the foreground (which means if the application is not enabled).
StopwatchBoolean
  • 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) 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.
iPhone/iPadIOS Widget This property is not available.
TitleCharacter stringNotification title.
The name of the application will be used if no title is specified.
VibrationBoolean
  • 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.
Android Management of notification categories (from Android 8.0):
  • If a category was specified when the notification was added (Category property), this property is ignored. The notification will use the corresponding property of the category it is associated with.
  • If no category was specified when the notification was added (Category property), the notification will be associated to the preset category corresponding to the value of the Priority property.
    • If the preset category exists, this property is ignored: the notification will use the corresponding property of the preset category it is associated with.
    • If the preset category does not exist yet, this property is used to define the properties to create one.
iPhone/iPadIOS Widget This property is not available.

Properties specific to Notification variables for a push notification

The following properties can be used to handle a notification:
Property nameType usedEffect
ActionLabelCharacter stringCaption for the action button of the notification.
Android This property is not available.
ActivateApplicationBoolean
  • True if the application must be displayed in the foreground during the click on the notification.
  • False (default value) otherwise.
iPhone/iPadIOS Widget This property is not available.
BadgeIntegerNumber displayed by the icon of the application.
Android On Android, this property is supported from version 8.0.
CategorynotificationCategoryCategory 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.
iPhone/iPadIOS Widget This property is not available.
ColorLEDIntegerColor 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 WLanguage preset color.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.
Android Management of notification categories (from Android 8.0):
  • If a category was specified when the notification was added (Category property), this property is ignored. The notification will use the corresponding property of the category it is associated with.
  • If no category was specified when the notification was added (Category property), the notification will be associated to the preset category corresponding to the value of the Priority property.
    • If the preset category exists, this property is ignored: the notification will use the corresponding property of the preset category it is associated with.
    • If the preset category does not exist yet, this property is used to define the properties to create one.
iPhone/iPadIOS Widget This property is not available.
ContentCharacter stringCustom data of notification. This data is not displayed in the notification.
DeletableBoolean
  • 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:
  • The application is closed.
  • Calling the NotifDelete function .
  • If the WLanguage procedure run on the click (ActionClick property) returned True or returned no value.
iPhone/iPadIOS Widget This property is not available.
DisplayLEDBoolean
  • 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.
Android Management of notification categories (from Android 8.0):
  • If a category was specified when the notification was added (Category property), this property is ignored. The notification will use the corresponding property of the category it is associated with.
  • If no category was specified when the notification was added (Category property), the notification will be associated to the preset category corresponding to the value of the Priority property.
    • If the preset category exists, this property is ignored: the notification will use the corresponding property of the preset category it is associated with.
    • If the preset category does not exist yet, this property is used to define the properties to create one.
iPhone/iPadIOS Widget This property is not available.
DropDownTextCharacter stringDrop-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).
iPhone/iPadIOS Widget This property is not available.
FormatnotificationFormatDisplay 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.
iPhone/iPadIOS Widget This property is not available.
GroupCharacter stringName 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.
iPhone/iPadIOS Widget This property is not available.
IconCharacter stringPath of the image corresponding to the icon associated with the notification.
The icon of the application will be used if no icon is specified.
LargeIconCharacter stringPath 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 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.
iPhone/iPadIOS Widget This property is not available.
LocalBoolean
  • 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.
iPhone/iPadIOS Widget This property is not available.
MessageCharacter stringMessage of the notification.
PriorityInteger constantPriority 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.
Android Management of notification categories (from Android 8.0):
  • If a category was specified when the notification was added (Category property), this property is ignored. The notification will use the corresponding property of the category it is associated with.
  • If no category was specified when the notification was added (Category property), the notification will be associated to the preset category corresponding to the value of the Priority property.
    • If the preset category exists, this property is ignored: the notification will use the corresponding property of the preset category it is associated with.
    • If the preset category does not exist yet, this property is used to define the properties to create one.
iPhone/iPadIOS Widget This property is not available.
SecondaryMessageCharacter stringSecondary 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.
iPhone/iPadIOS Widget This property is not available.
SoundCharacter stringPath 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).
Android Management of notification categories (from Android 8.0):
  • If a category was specified when the notification was added (Category property), this property is ignored. The notification will use the corresponding property of the category it is associated with.
  • If no category was specified when the notification was added (Category property), the notification will be associated to the preset category corresponding to the value of the Priority property.
    • If the preset category exists, this property is ignored: the notification will use the corresponding property of the preset category it is associated with.
    • If the preset category does not exist yet, this property is used to define the properties to create one.
StopwatchBoolean
  • 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) 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.
iPhone/iPadIOS Widget This property is not available.
TitleCharacter stringNotification title.
The name of the application will be used if no title is specified.
iPhone/iPadIOS Widget This property is not available.
VibrationBoolean
  • 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.
Android Management of notification categories (from Android 8.0):
  • If a category was specified when the notification was added (Category property), this property is ignored. The notification will use the corresponding property of the category it is associated with.
  • If no category was specified when the notification was added (Category property), the notification will be associated to the preset category corresponding to the value of the Priority property.
    • If the preset category exists, this property is ignored: the notification will use the corresponding property of the preset category it is associated with.
    • If the preset category does not exist yet, this property is used to define the properties to create one.
iPhone/iPadIOS Widget This property is not available.

Functions that use the Notification type

The following functions handle the Notification variables for a local notification:
NotifAddAgrega una notificación a la barra del sistema (Android) o al centro de notificaciones (iOS).
NotifDeleteElimina una notificación de la barra del sistema.
NotifModifyModifica una notificación que se muestra actualmente en la barra del sistema del dispositivo.
NotifPushSendEnvía una notificación push a un dispositivo móvil (iOS o Android).
ThreadPersistentHace que un Thread sea persistente.

Reinitialization

You can use VariableReset to reset the content of a Notification variable.
Versión mínima requerida
  • Versión 16
Esta página también está disponible para…
Comentarios
NotificationDisplay
Se for para o Windev veja esse exemplo:

https://repository.windev.com/resource.awp?file_id=281474976710849;notificationdisplay
BOLLER
30 08 2019

Última modificación: 28/02/2024

Señalar un error o enviar una sugerencia | Ayuda local