It is possible to configure the notifications Push to an application made with XOne WITHOUT using the XOne Replicator Server component, in such way that the notifications sending is made with an external tool, but the frameworks may detect these notifications, and they can interact with them.
Nowadays, this functionality only is available for Android devices.

The implementation consists of three parts:

  1. Registering the device in the Cloud.
  2. Sending the Push message.
  3. Recepction of the Push message.


Registering the device in the Cloud


The registration of the device in the Cloud must be done for Google Push notifications and sending the Token Push back to the server which is going to make the sending of the notifications.

For this, it is required:

  • Defining the push-id=“NumeroIdentificador” attribute in the <app> node of the mappings, being “NumeroIdentificador”, the ID Sender get in the Google APIs console, such as it was explained in the Android devices section.
  • The Token Push is sent to the external server, that preferably must be done with a secure connection with an online collection. Executing the following method when login in the application, specifically, the JavaScript code is indicated:


   appData.registerPush(function(mEvento) 
  {
    mEvento.pushToken});


Sending of the Push Message


For more info about how to implement the push messages in an application, please, just follow the following link:

http://developers.google.com/cloud-messaging/downstream

The customer application, will call to the push provider (google - apple) and those ones send the PUSH notification to the device in question.

So they can send us a notification and our framework is able to interpret it, besides the information sent it is necessary to add some “extra” parameters:

  • Datum: “source”, with “push_server” value. Necessary for the framework to be able to distinguish the origin of the Push Notification and act accordingly.
  • Datum: “notification_title”, which value will be the Push Notification title.
  • Datum: “notification_message”, which value will be the Push Notification message.


The rest of data passed will be the ones received in the device to be processed as we want to, following we show an example of messages:

 { "data": {
    "datomensaje": "Esto es una prueba",
    "source": "push_server",
    "notification_title": "Titulo de la notificacion",
    "notification_message": "Mensaje de la notificacion"
  },
  "to" : "bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdF..."
 }


Reception of the Push Message


To process the Push message we will have to define a “onpushnotificationclick” node in the “Empresas” collection, where we will enter directly when the user clicks on the notification received on the device.

In this node we put a parameter, which in the example we have called “mensajepush”, that will contain the values we have received in the Push message.

datomensaje is the name of one of the data that comes in the Push message of the server.
We can put as many as we need, always keeping in mind that they CANNOT be called with special characters such as spaces, accents, ñ…


 <onpushnotificationclick>
    <action name="runscript">
    <param name="mensajepush" />
            <script language="vbscript">
                ui.showToast "vbscript: " + mensajepush.datomensaje
         </script>
    </action>
 </onpushnotificationclick>


More info about the Replica with Push in here