One server sending push notifications to Android and iOS devices

前端 未结 3 1687
北海茫月
北海茫月 2021-02-15 15:54

Our organization has an Android app and an iOS app.

We want to start pushing notification to these apps.

Android has GCM. Apple has APNS.

But we want to

3条回答
  •  灰色年华
    2021-02-15 16:12

    As a little background this is for a university setting where multiple colleges apps as well as distance education may be using the service. Here is the approach that we are using in our organization. If you look at the way APNS works it can be used by just sending a web call to the APNS service with the token id. GCM is very close to the same type of system. Basically create a JSON package and send it to the desired service.

    Here is our steps we used to create this service.

    1. Server admins created a server and database that can be called that will collect the tokens from both android and ios devices. When the device registers we also send what type of device it is. This is possible since we are just sending data to the database that is has been created.

    2. From here we then created a couple of python scripts that send the data do the desired service whether it is ios or android. These scripts gather the appropriate data from the database and sends the packaged data (JSON package) to APNS for ios message and GCM for google cloud.

    3. We also created a web interface so that those who need to send messages to the devices can.

    The rest of the implementation is up to you to decide the best way to utilize the service. For example when to check for invalid devices, Because we are planning on using this same server for multiple applications we can send the type of device, token, application, or whatever else is needed for an application to distinguish it from others we produce so that each application that wants to use the service can. I hope this helps and gives you some idea on how to accomplish this.

提交回复
热议问题