Android implementation of information push

Source: Internet
Author: User
Tags android push notification

Recently honored to participate in the development of the company's CMPP SMS Gateway program, using the Apache Mina Framework implementation. The project has a deeper understanding of socket communications and long connections, so I want to try to push the information that Mina uses on the Android platform. After understanding found that there are already a lot of shaping the framework to achieve the Android platform information push, especially ANDROIDPN.

At ordinary times we develop mobile phone client, are indispensable to the server interaction, then when the server has new data, how the client knows? There are generally two ways to do this:

1 The client periodically (polling at intervals) initiates a request to the server to detect the presence of new data. If the polling frequency is too slow, it may cause the acquired information to become obsolete, and if the polling frequency is too fast, it will consume more power and mobile phone traffic;

2 The use of Android broadcast mechanism to intercept the message sent by the server. That is, when the server has new data, the server to all the Android clients send text messages, the client based on broadcast mechanism to intercept the SMS and through the mobile client application rendering. The cost of this scheme is high and it is necessary to apply to the telecom operators for SMS sending port.

The above two kinds of implementation methods, there are many drawbacks, and can not really meet the requirements, that there is no better way to achieve it? Of course, that's information push. Push means that when new data is available, the server side will "push" the data to the client, without the need for the client to constantly detect. There is no longer much explanation for "information push", which is demonstrated directly by a ANDROIDPN example.

ANDROIDPN, the Android push Notification, is the information push framework for the Android platform, a Java implementation based on the XMPP protocol, which includes a complete server-side and client-end program. Therefore, we do not have to develop a line of code, you can experience the information push, what is waiting for, do it immediately. ANDROIDPN frame Download Address: http://sourceforge.net/projects/androidpn/files/, download the following files:

Where Androidpn-server is a server-side program that contains executable scripts that can be run directly; Android-demoapp is a demo example that will be used directly to demonstrate; Androidpn-client is the client source code, You can use it to study the internal implementation of ANDROIDPN.

First step: Start the ANDROIDPN server program. That is, click Run Android-server-0.5.0\bin\run.bat. After startup is complete, you can access the following interface through the browser:

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.