Push notifications with cordova

Hello, I need to develop a cordova based chat app. I need that even if the app is not running clients can still receive notifications. Since I know that is only possible with native push notifications, it seem very interesting that backendless supports them. What I need to know is: do you javascript api allow sending a native push notification directly to another device? Or I need to write custom business logic server side to handle it?
many thanks


Sending (publishing) a push notification can be done with all native Backendless clients SDKs (there is also REST API for that). However, in order to receive a push notification, you need to have native code (Java on Android, Obj-C/Swift on iOS).


Ok, so: backendless does not have any api on client side that wraps native push notifications?
My other question about publishing notifcations was to understand if you have both client and server side javascipt api for sending native push notification or if you have just server side api and when a client wants to send a notifications it must make a request to the server api

Backendless provides Android and iOS APIs for receiving push notifications. There is nothing for JS for the receiving side. A JS client can use the API to send/publish push notifications though.

Hi, I try to explain better what’s my point:

I need to develop a cordova based mobile app where I need to send a push notification to a client.
With push notification I mean using android’s GCM and Apple’s APNS.
The push notifications can be sent:

    from a client: this is the case for example of a chat message. How will I implement this?
    I can use a backendless's crossplatform javascript client api which is able to send a native push notification directly to a client. In this case what will happen if the client is unreachable? Will this be managed directly by GCM or APNS? I need to implement server side logic for sending native push notification and the client must interact with the server?
    From the server. Does backendless have javascript server side api for sending native push notifications?
many thanks again

Here’s the API for publishing push notifications from a JS client:


I am not sure what you mean by the “client is unreachable”. Any device that registers with Backendless using the device registration API (Android, iOS) will receive push notifications send by the JS client.


By the “client is unreachable” if mean for example that it does not have internet connection, so the notification must reach the client once it get connected again.

I ask you another question which can make the point more clear. In the documentation on the “core classes” section, I see that the DeliveryOptions object has the pushPolicy property

// determines how message will be published. Possible values are:
  // "ONLY" - message is published only as a push notification
  // "ALSO" - message is published both as a push notification AND a pub/sub message
  // if the value is not set, message is published as a pub/sub message
  this.pushPolicy = args.pushPolicy || undefined

Now from what I understood the difference between pub/sub messages and push notifications is that:

    pub/sub messages can be received if the communication channel is estabilished (EG: the app is running) push notifications instead can be received even if the app is not running/killed and the notifications appears even on the lock screen
Now the point is: when I send a message, how can I know if I need to send a pub/sub message or a push notification? How can I know if an user is online or not?


To determine if a user is online or offline would be something that you handle within your app - Backendless does not provide that info out of the box. You’re welcome to use Data service and store information about user’s online presence and then use that to determine what mechanism to use to send a message.