Push notification from own Server


Hi guys,
I am working in Nativescript project. We have a java server. But i dont know the way push notification from own server to our application. Anyone can help me?


First thing, you can never hit any of your device directly. A push notification should always go through APNS (iOS) or GCM / FCM (Android) servers.

Either you use Firebase, UrbanAirship or any other third party or even your own server, they have to send a request to Apple Push Notification Server in case of iOS device or Google / Firebase Cloud Messaging server in case of Android device.

Maintaining your own server for sending push will be a pain,

  • You have to keep track of the device platform the token belongs
  • I guess Android supports max 1k recipients per request. If you have more than 10k users in your database, you may have to send 10 request with 1k recipients each.
  • Last time when I tried APNS was even worser, it happens through socket and you have to make sure your socket is not disconnected, if then you have to handle that scenario (Apple may disconnect you for various reasons not just due to connection problem).
  • You have to handle expired tokens yourself.

If you use Firebase kind of services it handles all these for you, in addition you get channel based subscription, easy apis etc., So I would personally recommend going with Firebase.


For iOS, Apple explains how to do it here: https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/APNSOverview.html#//apple_ref/doc/uid/TP40008194-CH8-SW1