How to send a signal to the application from ionic cloud?


#1

I have an ionic 2 application built for android and ios. I want to notify some events such as new data available in the server to the mobile app. But I can’t use push notifications since I don’t want to display anything to the user, the application should take care of the event. I have heard about silent push notification, but I can’t find any options for this in ionic cloud, and I am not sure whether that is what I want.

I can implement this using an external library like socket.io, but it would be great if I can do it with ionic cloud itself.


#2

You can - you just have to create a payload that isn’t displayed. Ionic Push ist “just” a server to send messages of arbitrary data.

If I remember correctly you leave out a “alert” key in the payload and replace it with “data”.

The docs of this plugin are quite nice: https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/PAYLOAD.md#push-message-arrives-with-app-in-background (You don’t have to use this plugin, this jsut explains possible notification payloads)