Build XMPP push messages to your phone

Source: Internet
Author: User

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

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.