Android Push principle (Android push Notification) detailed _android

Source: Internet
Author: User
Tags android push notification

Android Push principle

Since the recent project involved Android push, I saw something about Android push, and we know that the Android push can come down to 3 kinds of implementations:

1, POLL, pull. The general idea is to send the request to the server regularly, and then let the server return the information itself.

Advantages: Simple to implement.
Disadvantage: Poor real-time. If there are many small connections at timed intervals, there are high pressure requirements on the server. It is said that the electricity ... I don't know if it's true.

2, SMS, MMS mode . It is said to intercept MMS and parse content. This has not been hands-on.

Advantages: Simple to implement. Real-time sex.
Disadvantage: The cost of SMS services. Your!

3, TCP/IP, long-lasting long connection. simply set up a persistent TCP/IP connection with the server, and the server can send you a message.

Advantages: Good real-time performance.
Disadvantage: It is more difficult to achieve. It is said to be more cost-electric ... I haven't tested it.

Poll is simpler, using timer and TimerTask timers, and several HTTP-related classes to achieve basic functionality, and then resolve the server's return information itself.

It is mainly about the implementation of persistent long connection:1, based on IBM's MQTT implementation. 2, based on XMPP implementation

Based on the XMPP implementation there is a ANDROIDPN project, open source. Although I used MQTT in the back item. Because ANDROIDPN is not mature enough, there are some bugs in it, I can not repair it temporarily. Because I've only looked at the source code on the Android side, maybe some bugs need to be modified on the server side. ( the problem that bothers me for a long time is that after the server restarts, the ANDROIDPN handset can not be reset, temporarily put down, wait for the need to chew it again )

Its project source code here can be: http://sourceforge.net/projects/androidpn/went in after the files tag has 3 resources:

Androidpn-server Server-side code
Androidpn-demoapp instance (honestly, nothing)
Androidpn-client phone-side code

Add: I remember importing items may appear: Unable to resolve target ' Google Inc.: Google apis:7 ' error prompts.

WORKAROUND: Project Right button, Properties,resource,text file Encoding,other, select UTF-8
Android,project build Target, select Android1.5

Thank you for reading, I hope to help you, thank you for your support for this site!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.