There are three main ways to push server-side to Android clients:
1. The client periodically goes to the server to fetch or to maintain a long socket, from the nature of this is not called push, this is to go to the server to pull the data. But the implementation is simple, the main disadvantage: power consumption, etc.
2.Google C2DM, specifically not detailed, shortcomings, servers in foreign countries, you know, not very stable.
3.XMPP protocol, which is an XML-based delivery protocol with strong flexibility and scalability. It is characterized by the transfer of complexity from the client to the server side.
I heard that gtalk, QQ, IM, etc. all use this protocol.
Next talk about XMPP's application on the Android client. It is divided into two parts: server Building and client implementation.
<IGNORE_JS_OP>
Service-Side building:
If you want to test the function, directly with the establishment of a good service on the line, download Androidpn-server-0.5.0-bin.zip, because the attachment is too large, upload not up
:Http://sourceforge.net/projects/androidpn/files/?source=navbar
Click on the bin directory to get Run.bat, directly set up a good service, on the browser inputhttp://127.0.0.1:7070 into the management interface. Such as:
<IGNORE_JS_OP>
If you want to change the service yourself, download the attachment <IGNORE_JS_OP> androidpn-server-0.5.0-src.zip (303.73 KB, download number: 5140), modify it yourself.
To display the managed Send page:
<IGNORE_JS_OP>
Client implementations:
Download Project source <IGNORE_JS_OP> androidpn-client-0.5.0.zip (347.74 KB, Downloads: 6232), import project, change an IP address before running , modify the Xmpphost in the Androidpn.properties file to xmpphost=10.0.2.2
Reason: The simulator access to the machine needs to be changed to 10.0.2.2, as described in the SDK.
<IGNORE_JS_OP>
Operating interface:
<IGNORE_JS_OP>
<IGNORE_JS_OP>
To send a message from the server, the client runs the interface:
<IGNORE_JS_OP>
<IGNORE_JS_OP>
Finally saw the push sent.
Setting up XMPP push messages to your phone