Set up XMPP protocol to enable self-propelled messages to mobile phones

Source: Internet
Author: User

About server-side push to Android client, there are three main ways: 1. The client periodically goes to the service to fetch or to keep 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 realization of simple, the main disadvantage: power consumption, such as 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>

1.jpg (39.38 KB, download count: 535)

Download attachments to albums

2011-12-6 21:32 Upload

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 Run.bat, directly set up a good service, enter http://127.0.0.1:7070 on the browser to enter the management interface. such as: <ignore_js_op>

2.jpg (62.53 KB, download count: 502)

Download attachments to albums

2011-12-6 21:32 Upload


If you would like to change the service yourself, download accessories <ignore_js_op> androidpn-server-0.5.0-src.zip (303.73 KB, download number: 4904)

2011-12-6 21:43 Upload Click file name to download attachments

, modify it yourself.
Show the admin send page: <ignore_js_op>

8.jpg (63.78 KB, download count: 452)

Download attachments to albums

2011-12-6 21:38 Upload


Client implementation: Download project source code <ignore_js_op> androidpn-client-0.5.0.zip (347.74 KB, download count: 5945)

2011-12-6 21:39 Upload Click file name to download attachments

, import the project, change an IP address before running, modify the Xmpphost in the Androidpn.properties file as the 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>

3.jpg (82.43 KB, download count: 523)

Download attachments to albums

2011-12-6 21:33 Upload

Operating interface: <ignore_js_op>

4.jpg (16.27 KB, download count: in)

Download attachments to albums

2011-12-6 21:32 Upload

<ignore_js_op>

5.jpg (40.06 KB, download count: 449)

Download attachments to albums

2011-12-6 21:32 Upload

Send message from server, client run interface: <ignore_js_op>

6.jpg (39.64 KB, download count: 446)

Download attachments to albums

2011-12-6 21:32 Upload

<ignore_js_op>

7.jpg (34.03 KB, download count: 456)

Download attachments to albums

2011-12-6 21:32 Upload


Finally saw the push sent.

Http://www.apkbus.com/android-18168-1-1.html

Set up XMPP protocol to enable self-propelled messages to mobile phones

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.