ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Mobile specific functions / Phone functions
  • Overview
  • Principle for sending a PUSH notification to an Android device from an external language
  • Push notification by using the GCM platform
  • Push notification by using the Firebase platform
  • Header description
  • Body description
  • Description of the notification format: Correspondence of WLanguage Notification properties
  • Description of the notification format: Correspondence of WLanguage notificationFormat properties
  • Example of JSON document
  • Principle for sending a PUSH notification to an iOS device from an external language
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
Overview
An application written in WINDEV Mobile Android or iOS can receive Push notifications. These Push notifications can be sent from:
  • A WINDEV application or a WEBDEV site by NotifPushSend.
  • An application or a site written in an external language (Java, PHP, C#, etc.).
When sending a Push notification from an external language, you must identify and respect:
Principle for sending a PUSH notification to an Android device from an external language

Push notification by using the GCM platform

To send a Push notification to an Android device, the server application must perform an HTTP POST request to the following address https://gcm-http.googleapis.com/gcm/send.
This request must include:
  • a header.
  • a body describing the notification to send.
CAUTION: From WINDEV Mobile 22 update 1, sending push notifications for Android is using the Firebase platform (instead of Google Cloud Messaging, GCM). The former projects can still continue to use the GCM solution but the new projects are necessarily using Firebase. WINDEV Mobile supports the push notifications via Firebase from version 22 Update 1.

Push notification by using the Firebase platform

To send a Push notification to an Android device, the server application must perform an HTTP POST request to the following address https://fcm.googleapis.com/fcm/send.
This request must include:
  • a header.
  • a body describing the notification to send.
CAUTION: From WINDEV Mobile 22 update 1, the new projects are necessarily using Firebase to send push notifications.

Header description

The header must contain at least the two following elements:
  • Content-Type:application/json
  • Authorization:key=<GCM Identifier/Firebase>
<GCM Identifier/Firebase> corresponds to:

Body description

The request body must correspond to a document in JSON format containing:
  • The list of tokens representing the devices onto which the notification will be sent.
    "registration_ids": [<id device 1>,...<id device N>]
  • The version of data exchange format (mandatory).
    "WX_PUSH_EXT_VERSION":"1.0"
  • The notification data as key-value couples for each one of the Notification properties to assign. There is no need to provide the value of all Notification properties. The non-assigned properties will take their default value.
Remark: The current version of exchange format is "1.0".

Description of the notification format: Correspondence of WLanguage Notification properties

Name of WLanguage propertyName of JSON keyType of value
AdditionalActionNot supported by the push notifications
ActivateApplicationWX_PROP_ACTIVATEAPPLICATIONBoolean
DisplayLEDWX_PROP_DISPLAYLEDBoolean
StopwatchWX_PROP_CHRONOMETERBoolean
ContentWX_PROP_CONTENTCharacter string
ColorLEDWX_PROP_COLORLEDInteger
FormatWX_PROP_FORMATCharacter string in JSON format (see the table below)
LargeIconWX_PROP_LARGEICONCharacter string
IconWX_PROP_ICONCharacter string
LocalWX_PROP_LOCALBoolean
MessageWX_PROP_MESSAGECharacter string
SecondaryMessageWX_PROP_SECONDARYMESSAGECharacter string
PriorityWX_PROP_PRIORITYInteger
SoundWX_PROP_SOUNDCharacter string
DeletableWX_PROP_DELETABLEBoolean
DropDownTextWX_PROP_DROPDOWNTEXTCharacter string
TitleWX_PROP_TITLECharacter string
VibrationWX_PROP_VIBRATIONBoolean

Description of the notification format: Correspondence of WLanguage notificationFormat properties

Name of WLanguage propertyName of JSON keyType of value
ContentWX_PROP_CONTENTCharacter string
LargeIconWX_PROP_LARGEICONCharacter string
TitleWX_PROP_TITLECharacter string
TypeWX_PROP_TYPEInteger

Example of JSON document

Example of JSON document describing a push notification to send:
{
"registration_ids": ["Aki9 ... yXgt","BTh44 ... iQW)"],
"data":
{
"WX_PUSH_EXT_VERSION":"1.0",
"WX_PROP_TITLE":"Title of the notification",
"WX_PROP_MESSAGE":"Message of the notification",
"WX_PROP_ACTIVATEAPPLICATION":true,
"WX_PROP_FORMAT":
{
"WX_PROP_TYPE":1,
"WX_PROP_CONTENT":"Message of the notification\r\non two lines",
}
}
}
Principle for sending a PUSH notification to an iOS device from an external language
CAUTION : this format may change WITHOUT notice.
To send a Push notification to an iOS device, you must:
  1. Follow the procedure for payload creation on the Apple site: https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/BinaryProviderAPI.html
  2. Provide a JSON in the following format.
    {
       "aps": {
           "alert": {
               "body": "Bob wants to play poker",
               "action-loc-key": "PLAY"
               "launch-image": "play.png"
           },
           "badge": 5
    "sound": "bingbong.aiff"
       },
       "wd": "bar"
    }
Correspondence of WLanguage properties
Name of JSON keyName of WLanguage property
"body"Message
"action-loc-key"ActionLabel
"launch-image"Icon
"sound"Sound
"badge"Badge
"wd"Content
Minimum version required
  • Version 21
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help