PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
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
Sends a push notification to a mobile device (iOS or Android). This function can be used in a WINDEV application or in a WEBDEV site.
Example
// Send a push notification on iOS
TokensSend is array of Buffers
FOR i = 1 TO nbTokens
Add(TokensSend, tokens[i])
END

MyNotification is Notification
MyNotification..Message = "New notification"

MyCertificates is array of Certificates
MyCertificates = CertificateLoad("applecertif.cer", "")

MyResult is boolean
MyResult = NotifPushSend(MyNotification, TokensSend, ...
MyCertificates[1], typeServiceIOSRelease)

IF MyResult = False THEN
Trace(ErrorInfo())
END
Syntax

iPhone/iPad: Sending a notification Hide the details

<Result> = NotifPushSend(<Notification> , <Tokens> , <Identification> , <Server Type>)
<Result>: Boolean
  • True if the sending was successful,
  • False otherwise. ErrorInfo is used to identify the error returned by the notification service.
<Notification>: Notification
Name of Notification variable corresponding to the notification to send.
<Tokens>: Array of buffers
Name of Array variable containing the list of tokens representing the devices onto which the notification will be sent.
<Identification>: Certificate
Name of Certificate variable used to identify the application on the APN service.
This variable represents the certificate for the push notifications of application (obtained beside Apple). See Conditions required for the Push notifications in iOS for more details. This certificate may have been loaded by CertificateLoad.
<Server Type>: Integer constant
Type of server onto which the notification will be sent:
typeServiceIOSReleaseServer of IOS release (APN).
typeServiceIOSTestServer of IOS test (APN).

Android: Sending a notification Hide the details

<Result> = NotifPushSend(<Notification> , <Tokens> , <Identification> , <Invalid Tokens> [, <Platform>])
<Result>: Boolean
  • True if the sending was successful,
  • False otherwise. ErrorInfo is used to identify the error returned by the notification service. These errors can contain a list of invalid tokens that must be deleted from the token database.
<Notification>: Notification
Name of Notification variable corresponding to the notification to send.
<Tokens>: Array of buffers
Name of Array variable containing the list of tokens representing the devices onto which the notification will be sent.
<Identification>: Character string (with quotes)
Parameter for identifying the application on the GCM service (Google authorization key). A specific configuration is required to get this key. See Configuration required for the Push notifications in Android for more details.
<Invalid Tokens>: Array of buffers
Name of the Array of Buffers variable. This parameter is filled with the list of invalid tokens returned by the server.
iPhone/iPad NotifPushListInvalidIdentifiers returns the list of invalid tokens.
<Platform>: Optional Integer constant
Versions 22 and later
Platform that will be used to send the notification. The Android application that will receive he notifications must have been configured for this type of platform.
npeFirebaseFirebase platform.
New platform for sending push notifications.
This platform must be used for the new projects (from WINDEV 22 Update 1) or for the projects that do not use the push notifications yet.
npeGCM
(Default value)
Google Cloud Messaging platform.
Former Google solution for sending push notifications.
This platform must be used for the existing projects that already use the push notifications yet (projects created with a version earlier than WINDEV 22 Update 1)
New in version 22
Platform that will be used to send the notification. The Android application that will receive he notifications must have been configured for this type of platform.
npeFirebaseFirebase platform.
New platform for sending push notifications.
This platform must be used for the new projects (from WINDEV 22 Update 1) or for the projects that do not use the push notifications yet.
npeGCM
(Default value)
Google Cloud Messaging platform.
Former Google solution for sending push notifications.
This platform must be used for the existing projects that already use the push notifications yet (projects created with a version earlier than WINDEV 22 Update 1)
Platform that will be used to send the notification. The Android application that will receive he notifications must have been configured for this type of platform.
npeFirebaseFirebase platform.
New platform for sending push notifications.
This platform must be used for the new projects (from WINDEV 22 Update 1) or for the projects that do not use the push notifications yet.
npeGCM
(Default value)
Google Cloud Messaging platform.
Former Google solution for sending push notifications.
This platform must be used for the existing projects that already use the push notifications yet (projects created with a version earlier than WINDEV 22 Update 1)
Remarks
  • The push notification is sent to a notification service (Apple or Google) that redistributes this notification to a set of mobile devices.
  • The supported services are:
    • Google GCM.
    • Apple APN.
    The supported services are:
    • Versions 22 and later
      Google Firebase (Google GCM is supported for backward compatibility. Firebase is recommended by Google).
      New in version 22
      Google Firebase (Google GCM is supported for backward compatibility. Firebase is recommended by Google).
      Google Firebase (Google GCM is supported for backward compatibility. Firebase is recommended by Google).
    • Apple APN.
  • Android The notifications sent to the Android devices take into account the proxy defined by Proxy.
  • iPhone/iPad The notifications sent to the devices running iOS are direct (they do not transit via the proxy).
  • iPhone/iPad The Apple service allows 256 bytes of data per notification only. Therefore, pay attention to the amount of data sent in the Notification variable (the message for example) to avoid exceeding this limit. An error will occur if the limit is exceeded.
  • iPhone/iPad The connection to the APN server may fail if two notifications are sent in a very short time interval (if the server is still processing the first message).
  • iPhone/iPad To send push notifications on the iOS devices, the application must be able to access the ports 2195 and 2196 in TCP.
Related Examples:
WD Send Push Cross-platform examples (WINDEV Mobile): WD Send Push
[ + ] This example is used to send push notifications on Android and iOS devices.

It retrieves the identifiers of the mobile devices in the HFSQL database of the "WD Push Server" example then it sends the notifications via NotifPushSend.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230device.dll
Minimum required version
  • Version 19
This page is also available for…
Comments
Click [Add] to post a comment