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.
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
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
// Envoi d'une notification push sur iOS
TokensEnvoi is array of Buffers
MonMotDePasse is string ANSI = "Password"
 
FOR i = 1 TO nbTokens
Add(TokensEnvoi, tokens[i])
END
 
MaNotification is Notification
MaNotification.Message = "Nouvelle notification"
 
MonRésultat is boolean
MonRésultat = NotifPushSend(MaNotification, TokensEnvoi, ...
"certifapple.cer", MonMotDePasse, NomBundleID, typeServiceIOSRelease)
 
IF MonRésultat = False THEN
Trace(ErrorInfo())
END
Syntax

iPhone/iPad: Sending a notification Hide the details

<Result> = NotifPushSend(<Notification> , <Tokens> , <Identification> , <Password> , <TopicID> , <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 the variable of type Notification corresponding to the Notification to be sent.
<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
Full path of the file containing the certificate for the application push notifications (obtained from Apple). For more details, see Conditions required for the Push notifications in iOS.
<Password>: ANSI character string
Password of the file containing the certificate for Push notifications. If the file does not have a password, use an empty string (""). This parameter must correspond to an ANSI character string.
<TopicID>: Character string
Bundle identifier specified in the "General" section of the Xcode project generation wizard.
<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 the variable of type Notification corresponding to the Notification to be sent.
<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
Application identification parameter:
<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.
<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 should only be used for existing projects already using push notifications (projects created with a version prior to 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 should only be used for existing projects already using push notifications (projects created with a version prior to 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 should only be used for existing projects already using push notifications (projects created with a version prior to 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:
    • 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.
  • The notifications sent to the Android devices take into account the proxy defined by Proxy.
  • Versions 24 and later
    From Android 8, Notification s sent to Android terminals take into account the Notification category (also called "Channel")..
    New in version 24
    From Android 8, Notification s sent to Android terminals take into account the Notification category (also called "Channel")..
    From Android 8, Notification s sent to Android terminals take into account the Notification category (also called "Channel")..
  • Specific features for iOS:
    • The notifications sent to the devices running iOS are direct (they do not transit via the proxy).
    • 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.
    • 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).
    • 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_Push_Server Cross-platform examples: WD_Push_Server
[ + ] This example is a webservice used to store the identifiers required to sent Push notifications to mobile devices.
The "WM Push" application stores the Push identifiers in the database of this example.
The "WD Send Push" example then reads these identifiers in order to send the notifications.
Send Push Cross-platform examples: Send Push
[ + ] This example allows you to send push notifications to Android and iOS devices.
It retrieves the identifiers of the mobile devices in the HFSQL database of the "WD Push Server" example, then sends the notifications via the NotifPushSend function.
Component: wd270device.dll
Minimum version required
  • Version 19
This page is also available for…
Comments
Click [Add] to post a comment