Push is not a new technology, which has become popular in the internet age. But with the advent of the mobile internet era, push technology appears to be more important. Because in a smartphone, push to a certain extent, can replace the use of many years of text messages, but also compared to text messages, you can show users more information (such as images, tables, sounds, etc.).
Implementations of push technologies typically use the way the server pushes messages to the client. This means that the client can send messages to all active clients at the server end by registering them with the user name, key, and so on.
In fact, in many mobile operating systems, the authorities provide them with a push scheme, for example, Google's cloud push, IOS, Windows PHONE7/8 also provide similar push. However, these push the solution of the server are abroad, there are some push services (such as Google's cloud push) at home for some reason is not very stable, so the domestic in recent years has sprung up a lot of specifically for the people to build push service.
This article will start with all kinds of popular mobile operating systems to introduce the implementation of the push technology. Of course, our main goal is to discuss the Android push technology.
One, the push technology of iOS
Apple offers a perfect push for iOS, and the rationale is that Apple is offering its own push server, called APNs (Apple push Notification Service, MAC push notification server). The client device (IPhone, ipad, etc.) directly establishes a long connection with the APNs. However, messages sent to client devices are not generated by APNs, but are generated in servers (called provider) that are provided by the user who needs to send the message, and then provider the message to APNs, which is then passed to the client device by APNs. That is, the message is first generated by provider, and then provider the message to the APNs, and finally to the client device by APNs. The process of message delivery is shown in Figure 1.
Figure 1
The delivery of this token (device token) is always accompanied by sending a message to a client device to receive a message. To provide a message service using APNS, the application needs to provide the necessary information to the iOS registry, which is related to the current device device Token,ios after receiving Devicetoken, will query this APNs Whether the token is registered on the APNs (all iOS devices need to register an account with the Apple server for the first time, otherwise they cannot download the app from Applestore, and of course not use the push service), if they are already registered, APNs will return this devicetoken directly to the application. After the application obtains this devicetoken, it means that APNs has allowed to push the message to itself, and then it needs to send the device token to the push server (Provider). Here the application has successfully registered itself in the APNs. You can now generate the message you want to push by provider, and then provider will send the message to the APNS server, and the APNS server sends the message directly to the application. This process is complicated, but looking at the description in Figure 2 will give you a better understanding of the process. Each process describes the preceding number indicating the order in which to send the time.
Figure 2
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/extra/