AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Funciones específicas para móviles / Funciones de teléfono
  • WLanguage procedure called
  • Special cases
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
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.
Ejemplo
// Enable the push notifications
NotifPushEnable(RegisterPushNotif)
// Manage the registration
PROCEDURE RegisterPushNotif(Token is Buffer, NotifError is string)
IF Length(Token) > 0 THEN
	// Informs the application server about the new identifier
	SendIDOnServer(Token)
ELSE
	// Process the error
END
Sintaxis
NotifPushEnable(<WLanguage procedure> [, <Options>])
<WLanguage procedure>: Procedure name
Name of the 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:
notifPushAlertTypeThe mobile application will accept the push notifications in alert format.
Android Constant not available.
notifPushAllNotif
(Default value)
The mobile application will accept all types of push notifications.
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.

Please note: These options are taken into account the first time the application is installed.. Then, the user can modify the notifications accepted in the Notification Center of device.
Observaciones

WLanguage procedure called

The WLanguage procedure called by NotifPushEnable must have the following syntax:
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:
  • <Identifiant> Buffer token corresponding to the Record 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.
    Attention: 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 determines whether the application is started when a notification is received.
    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 The buffer that corresponds to the identifier can contain non-printable characters (e.g., binary zeros). To send this buffer to a third-party application (to send notifications, for example), it may be necessary to convert this buffer into hexadecimal (BufferToHexa) or Base64 (Encode) depending on the format expected by the application. If the application that retrieves the data is a WINDEV/WEBDEV/WINDEV Mobile application, you will need to perform the reverse conversion (HexaToBuffer or Decode) to be able to send the notifications.
  • <Erreur> String of characters describing a Record 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 cannot be contacted when calling NotifPushEnable (network connectivity problem, for example), the registration request will be sent again in increasing time intervals (1 hour maximum) until the request succeeds or an error is raised. Therefore, a long time can exist between the call to NotifPushEnable and the call to the procedure passed as parameter.
  • The function NotifPushEnable function is asynchronous because it executes a:
    • iPhone/iPad on the Apple server for iOS.
    • Android on the Google server for Android.
      Starting with Android 12, it takes longer to obtain the token when installing or reinstalling an application. The WLanguage procedure called by NotifPushEnable can be executed after the project has been initialized, or when the first window is opened.
Clasificación Lógica de negocio / UI: Lógica de negocio
Componente: wd300android.jar
Versión mínima requerida
  • Versión 19
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 28/03/2025

Señalar un error o enviar una sugerencia | Ayuda local