What is the best approach for generating notification in Android and Ios

Hi, Everyone

i want to get suggestions for generating notification for my application.

There could be two scenarios.

  1. generate push notification using GCM and APNS services its all depend on server when serve ping the app using above mention services, the app will receive push notification and perform further operation based on push notification.

  2. generation of local notification, in this scenario we will call http services using API’s in our application after some specific time for example after every 30sec to check if it is needed to generate local-notification in this case app will continuously checking hitting the server. what will be the architecture of this case? is it feasible or not?

please suggest what will be the best approach to generate notification?

I prefer to use 1)

In the second option, you will be generating a lot of unnecessary requests. You could have a third option, using a websocket, but that would require all of your apps instances to have an open socket to your server.
And this is not the real purpose of a websocket (you should use it for real time communication).
And there is a problem that the app must be running in both cenarios, or should be an background service for it.

The best approach, for me, is the first: who knows when a notification should be delivered is the server. It will send it to another server (a delivery server) and the device will receive it, and handles what is needed (show the notification in the tray, open the app if user click in it, etc…).

Thanks! for quick reply really informative!