PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • WLanguage procedure called
  • Special cases
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
Enables the management of push notifications in a WINDEV Mobile application (Android or iOS).
iPhone/iPad We advise you to call this function in the initialization process of the project because it must be run whenever the application is started.
Example
// Enable the push notifications
NotifPushEnable(RegisterPushNotif)
// Manage the registration
PROCÉDURE RegisterPushNotif(Token is Buffer, NotifError is string)
IF Length(Token) > 0 THEN
// Informs the application server about the new identifier
SendIDOnServer(Token)
ELSE
// Identifies the error
Info("Registration error: " + NotifError)
END
Syntax
NotifPushEnable(<WLanguage Procedure> [, <Options>])
<WLanguage Procedure>: Character string (with or without quotes)
Name of WLanguage procedure called when the application receives the registration identifier from the notification service.
<Options>: Combination of optional Integer constants
Registration options. Can correspond to one or more of the following constants:
notifPushAllNotif
(Default value)
The mobile application will accept all types of push notifications.
notifPushAlertTypeThe mobile application will accept the push notifications in alert format.
Android Constant not available.
notifPushBadgeTypeThe mobile application will accept the push notifications in badge format.
Android Constant not available.
notifPushSoundTypeThe mobile application will accept the sound push notifications.
Android Constant not available.
Caution: These options are taken into account during the first application setup. Then, the user can modify the notifications accepted in the Notification Center of the device.
Remarks

WLanguage procedure called

The WLanguage procedure called by NotifPushEnable has the following format:
PROCEDURE RegisterPushNotif(<Identifier> is buffer, <Error> is string)
This procedure is called when the registration toward the notification service is ended.
The parameters of this procedure are as follows:
  • <Identifier>: "Token" buffer corresponding to the registration identifier returned by the notification service. This buffer must be transmitted to the application server so that push notifications can be sent to the application.
    Caution: This buffer must be transmitted to the application server:
    • when its value changed in relation to the previous execution of the application. To do so, its value must be stored in a data file of the application or in a buffer on disk created by fSaveBuffer or SaveParameter.
    • if the application is started by the user (and not by the arrival of a push notification). ExeInfo is used to find out whether the application is started when a notification arrives.
    This buffer can be empty if a registration error occurred during the registration request. In this case, the <Error> parameter will be filled with the error message.
    • iPhone/iPad To transmit the buffer to an external application (that will send the notifications), this buffer will have to be converted in order to use the hexadecimal notation via BufferToHexa. Example:
      BufferToHexa(bufToken, 4, BigEndian)
  • <Error>: Character string describing a registration error. This parameter is filled only if an error occurred during the registration request.

Special cases

  • iPhone/iPad This function can be called only if the application includes a certificate for the push notifications.
  • iPhone/iPad If the function is called several times during the same execution of the application, only the first call is taken into account.
  • Android The device communicates with the Google Cloud Messaging (GCM) notification service by using the following ports: 5228, 5229 and 5230. Make sure that your firewall is configured accordingly.
  • Android If the Google Cloud Messaging notification service was not contacted during the call to NotifPushEnable (connectivity problem for example), the deregistration request will be automatically repeated with an increasing time interval (up to 1 hour) until the request is successfully performed or until an error occurred. Therefore, a long time can exist between the call to NotifPushEnable and the call to the procedure passed in parameter.
  • NotifPushEnable is asynchronous because it performs a request on the Apple server (or on the Google server for Android).
Related Examples:
Android Push Cross-platform examples (WINDEV Mobile): Android Push
[ + ] This example explains how to receive Push notifications on Android.

It calls the PushNotifActive function and returns the identifier to the WINDEV "WD Push Server" example that stores it.

Then, this identifier is read by the WINDEV "WD Send Push" example that sends the Push notifications to this Android example.
iOS Push Cross-platform examples (WINDEV Mobile): iOS Push
[ + ] This example explains how to receive Push notifications on iOS.

It calls the PushNotifActive function and returns the identifier to the WINDEV "WD Push Server" example that stores it.

Then, this identifier is read by the WINDEV "WD Sending Push" example that sends the Push notifications to this iOS example.
Components
Android wd230android.jar
Minimum required version
  • Version 19
Comments
Click [Add] to post a comment