PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
  • Behavior when a notification is received
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
Specifies the WLanguage procedure called when a push notification is received by a WINDEV Mobile application (Android or iOS).
Remark: This function must be called in the project initialization event, as the notifications can be received at any time of the application lifetime or when the application is started further to the reception of the notification.
Example
// Initialisation du projet
NotifPushProcédure(appelNotif)
PROCÉDURE appelNotif(MaNotif is Notification)
Info("Notification reçue: " + MaNotif.Message)
Syntax
NotifPushProcedure(<WLanguage procedure>)
<WLanguage procedure>: Procedure name
Name of the procedure that will be called when a push notification is received. This procedure must be a global procedure of application in the following format:
PROCEDURE <Nom de la procédure>(<Notification> est une Notification)
where <Notification> is a Notification variable corresponding to the notification sent by NotifPushSend.
Remarks

Behavior when a notification is received

The behavior when a notification is received is as follows:
  1. If the application is closed, the system displays the notification in the notification bar. The user can choose to validate the notification. If he does, the application is started.
    Android If no message is specified in the notification, the application is started and the notification is not displayed.
    Two cases may occur once the application is started:
    • If NotifPushProcedure was called in the project initialization code, the global procedure passed to this function as parameter is called, and the first window of the application is not opened.
      Remark: OpenMobileWindow must be called in the procedure.
    • If NotifPushProcedure has not been called, the first window of the application is opened.
  2. If the application is already started:
    • Android If a message or a title is specified in the notification, the system displays the notification in the notification bar. If the user clicks the notification, the procedure specified in NotifPushProcedure is called (nothing happens if it is not specified).
      If no message and no title is specified in the notification, the notification is not displayed and the procedure is called directly.
    • iPhone/iPad Two cases may occur:
      • If the application is in the foreground, the procedure of NotifPushProcedure is called directly. If no procedure is specified, only an "ok" button is displayed.
      • If the application is in the background, the system displays the notification. If the user validates the Notification, the application returns to the foreground and the Procedure of the NotifPushProcedure function is called.
Remarks:
  • The exeLaunch constant of ExeInfo allows you to know if the application was automatically started by the system further to the reception of a push notification:
    ExeInfo(exeLaunch) = exePushNotification
  • WinStatus allows you to test (if necessary ) the existence of a window in order to open it:
    // Résumé: Procédure appelée lors du clic sur une notification PUSH
    PROCÉDURE onPush(maNotif is Notification)
     
    IF WinStatus("FEN_Main") <> NotFound THEN
    // FEN_Main est déjà ouverte ou affichée
    RéceptionNotifPush(maNotif, True)
    ELSE
    // On ouvre la fenêtre d'accueil
    OpenMobileWindow(FEN_Main, maNotif)
    END
Related Examples:
WM Push Cross-platform examples: 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.
Component: wd270android.aar
Minimum version required
  • Version 19
Comments
Click [Add] to post a comment