PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Properties specific to the description of notificationAction variables
  • Various
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
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 Notification type.
From Android 4.1 (Jelly Bean, api level 16), additional actions can be associated with a notification (..AdditionalAction). These actions are represented as buttons located below the message of the notification.
Example of notification with two additional actions, "Respond" and "Delete":
Notes:
  • 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.
Note: See Declaring a variable for more details.
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)
PROCÉDURE 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 ..ActionClick is equal to an empty string (""), no action will be performed during the click and the notification will be automatically erased after the click.
  • <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,
    • ..ResponseChoice was filled.
      Otherwise, <Response> is equal to an empty string ("").
Note: We recommend that you 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".
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.
Note: 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 run from a phone or a tablet, the procedure specified in ..ActionClick will be called directely.
IconCharacter stringPath of 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.
ActionLabelCharacter stringCaption describing the action to perform. This property is mandatory: the action will be ignored if no caption is associated with the action.
QuestionLabelCharacter stringCaption of message displayed to ask for the user response. This caption is sued when ..ResponseChoice was filled.
A system message will be displayed if this property is not filled.
Note: These properties can be handled by using one of the following syntaxes:
  • <Variable Name>..<Property Name>
  • <Variable Name>.<Property Name>

Various

To reinitialize the content of a notificationAction variable, you have the ability to use VariableReset.
Minimum required version
  • Version 20
Comments
Click [Add] to post a comment