Android Push Notification for Information Push

Source: Internet
Author: User
Tags android push notification

This article describes how to use the AndroidPn project to implement push.

 

In the previous article, we mentioned how to implement the push solution in Android. One of the more mature solutions is to use the XMPP protocol. The AndroidPn project is an open-source project that uses the XMPP protocol to push information. Here we will introduce how to use it.

 

Features of Apndroid Push Notification:

Quick integration: provides a faster way to use than C2DM, avoiding various restrictions.

No Server SETUP required: reduces the extra server load by using cloud services.

Push messages to the website page at the same time, android mobile phone

Low Power Consumption and low traffic consumption.

 

Specific configuration process:

First, download androidpn-client-0.5.0.zipand androidpn-server-0.5.0-bin.zip.

: Http://sourceforge.net/projects/androidpn/

 

Decompress the two packages, import Eclipse to the client, configure the target platform, open the raw/androidpn. properties file, and configure the client program.

 

1. if a simulator is used to run the client program, configure xmppHost to 10.0.2.2. [The simulator considers 10.0.2.2 as the address of the host, 127.0.0.1 as the loopback address of the simulator, and 10.0.2.1 as the gateway address, 10.0.2.3 indicates the DNS address, and 10.0.2.15 indicates the network address of the target device.] For more information about simulators, see related information.

XmppPort = 5222 is the xmpp service listening port of the server.

 

Run androidpn-server-0.5.0 \ bin \ run. bat starts the server and accesses http: // 127.0.0.1: 7070/index from the browser. do (androidPN Server has a lightweight web Server that listens to requests on port 7070 and receives text messages from users)

 

When the client runs, the client initiates a connection request to the server. After successful registration, the server can identify the client and maintain a persistent connection with the client's IP address.

 

2. if it is a simulator test of another machine in the same LAN (or a real machine using the same wireless router wifi), you need to set this value to the LAN ip address of the server machine.

For example, your computer and android mobile phone both use the same wireless router wifi to access the Internet. The IP address of the computer is 192.168.1.2, And the IP address of the mobile phone is 192.168.1.3, in this case, you need to change the value to xmppHost = 192.168.1.1 or the IP address of your computer to use it on your mobile phone.

 

3. If it is a real machine test that is not in the same LAN, we need to set this value to the IP address of the server.

 

The specific configuration is shown in:

 

 

My computer IP address is 192.168.8.107

Main server running interface:

 

 

The push information is shown in the following interface:

 

Shows the test result:

 

Finally, I passed the test in my simulator and real machine. Pai_^

 

Finally, I hope to reprint friends can respect the author's labor results, plus reprint address: http://www.cnblogs.com/hanyonglu/archive/2012/03/16/2399655.html thank you.

 

Complete. Pai_^

 

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.