PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Properties specific to the description of notificationAction variables
  • Miscellaneous
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
notificationAction (Type of variable)
In french: notificationAction
The notifications (described by a Notification variable) have a default action that is run when the notification is clicked by the user. This action is defined by the ActionClick property of type Notification.
From Android 4.1 (Jelly Bean, api level 16), additional actions can be associated with a notification (AdditionalAction property). These actions are represented as buttons located below the message of the notification.
Example of notification with two additional actions, "Respond" and "Delete":
Remarks:
  • When the notification is displayed on a connected object like a watch (Android Wear), the additional actions can be accessed via a swipe movement to the left on the screen.
    In this case, each additional action is displayed on the entire screen.
  • On a phone or tablet, the buttons corresponding to the additional actions are visible only when the notification is expanded. 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 additional actions will be ignored if the notification is displayed on a device running a version earlier than Android 4.1.
The notificationAction type is used to define the advanced characteristics of an an additional action associated with a notification. The characteristics of this additional action can be defined and modified by several WLanguage properties.
Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
Example
n is Notification
n.Title = "New message"
n.Message = "Order #54781-4551"
n.SecondaryMessage = "customer@company.com"
n.LargeIcon = "envelope.png"
n.AdditionalAction[1].ActionLabel = "Respond"
n.AdditionalAction[1].Icon = "respond.png"
n.AdditionalAction[1].ActionClick = "procRespond"
n.AdditionalAction[2].ActionLabel = "Delete"
n.AdditionalAction[2].Icon = "delete.png"
n.AdditionalAction[2].ActionClick = "procDelete"
NotifAdd(n)
// Notification with response request for the connected objects
n is Notification
n.Title = "New message"
n.Message = "Order #54781-4551"
n.SecondaryMessage = "customer@company.com"
n.LargeIcon = "envelope.png"
n.AdditionalAction[1].ActionLabel = "Respond"
n.AdditionalAction[1].Icon = "respond.png"
n.AdditionalAction[1].ActionClick = "procRespond"
n.AdditionalAction[1].ResponseChoice = notifFreeResponse + CR + "Thank you for your order"
n.AdditionalAction[1].QuestionLabel = "What is your response?"
n.AdditionalAction[2].ActionLabel = "Delete"
n.AdditionalAction[2].Icon = "delete.png"
n.AdditionalAction[2].ActionClick = "procDelete"
NotifAdd(n)
PROCEDURE procRespond(n is Notification, sResponse is string)
Email.Subject = "RE: " + n.Message
Email.Recipient[1] = n.SecondaryMessage
Email.NbRecipient = 1
IF sResponse <> "" THEN
Email.Message = sResponse
END
EmailRunApp()
Remarks

Properties specific to the description of notificationAction variables

The following properties can be used to handle an additional action:
Property nameType usedEffect
ActionClickValue or Name of procedureName of WLanguage procedure called when the user clicks the button corresponding to the action.
This procedure has the following format :
PROCEDURE <Procedure Name> (<Notification>, <Response>)
where:
  • <Notification> is a Notification variable corresponding to the notification associated with the selected action.
    If the WLanguage procedure returns True or if it returns no value, the notification will be automatically deleted from the system bar.
    If the procedure returns False, the notification will still be displayed.
    If the value of the ActionClick property corresponds to an empty string (""), there will be no on-click action and the notification will be automatically deleted afterwards.
  • <Response> is a character string filled with the response given by the user if the following conditions are fulfilled:
    • the action was run from a connnected object,
    • the ResponseChoice property was specified.
      Otherwise, <Response> is equal to an empty string ("").
Remark: 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 describing the action to perform. This property is mandatory: the action will be ignored if no caption is associated with the action.
IconCharacter stringPath of the icon representing the action. This property is mandatory: the action will be ignored if no icon is associated with the action.
Caution: From Android 7.0, the icons for notification actions are not displayed anymore.
QuestionLabelCharacter stringText of the message displayed to ask for the user response. This text is used when the ResponseChoice property has been specified.
A system message will be displayed if this property is not filled.
ResponseChoiceCharacter stringCorresponds to the different preset responses that will be proposed to the user during the click on the action. The responses must be separated by a Carriage Return (CR).
To allow the user to enter a free response, use the notifFreeResponse constant. This constant can be combined with one or more preset responses.
Remark: The choice of responses is proposed to the user only when the action is run from a connected object operating in Android Wear. If the action is executed from a phone or tablet, the procedure specified in the ActionClick property will be called directly.

Miscellaneous

You can use VariableReset to reset the content of the notificationAction variable
Minimum version required
  • Version 20
Comments
Notificationdisplay
Se for para o Windev veja esse exemplo:

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