Search code examples
phplaravelfirebase-cloud-messagingwindev

PC Soft WinDEV Mobile not receieving the notification properties


I am sending FCM notifications via laravel-notification-channels/fcm and this seems to be working as exepected:

public function toFcm($notifiable): FcmMessage
{
    $message = (new FcmMessage(notification: new FcmNotification))->data([
        'WX_PUSH_EXT_VERSION' => '1.0',
        'WX_PROP_CONTENT' => 'Test',
        //'WX_PROP_MESSAGE' => 'Your account has been activated',
        'WX_PROP_LOCAL' => false,
        'WX_PROP_TITLE' => 'Account Activation',
        'WX_PROP_ACTIVATEAPPLICATION' => true,
        'WX_PROP_PRIORITY' => 1,
        'WX_PROP_DELETABLE' => true,
        'WX_PROP_VIBRATION' => true,
    ])->custom($this->customOptions());

    config()->set('fcm.debug', $message->toArray());

    return $message;
}

Following the PC Soft WinDEV Mobile documentation (https://doc.windev.com/en-US/?1000021399) I can see that if I pass WX_PROP_MESSAGE this displays a local notification that when clicked on, hits the Procedure.

Following the documentation again, that states if no WX_PROP_MESSAGE is sent, the procedure should be hit without a local notification being shown (I only want to do this to sync), it does indeed hit the procedure which is defined like so:

PROCEDURE NotificationCallBack(MyNotif is Notification)
 
<COMPILE IF ConfigurationType=Android>
    sContent    is string
    sFContent   is string
    sSecondary  is string
    sTitle      is string
    Info("Im In")
    sContent    = MyNotif.Content // I expect Test here but its empty
    sTitle      = MyNotif.Title
    Info(sContent)
    Info(sFContent)
    Info(sSecondary)
    Info(sTitle)
<END>

The problem is every single one of these Notification properties are empty when the notification hits... what am I doing wrong here? The payload I am sending looks like this:

{
  "data": {
    "WX_PUSH_EXT_VERSION": "1.0",
    "WX_PROP_CONTENT": "Test",
    "WX_PROP_LOCAL": false,
    "WX_PROP_TITLE": "Account Activation",
    "WX_PROP_ACTIVATEAPPLICATION": true,
    "WX_PROP_PRIORITY": 1,
    "WX_PROP_DELETABLE": true,
    "WX_PROP_VIBRATION": true
  },
  "registration_ids": [
    "<TRUNCATED>"
  ]
}

My expectation here is that MyNotif.Content has Test inside of it which I will later change to a JSON payload to direct the phone to sync to specific parts of the server.

You can see from the documentation on the Notification that we need the Content property for the custom notification data: https://doc.windev.com/en-US/?1000019441&name=notification_variable_type


Solution

  • This is an issue described here: the JSON keys must be in French, not in English. You will find the French version of the documentation page here.

    In particular, the content key is WX_PROP_CONTENU, not WX_PROP_CONTENT.