Open the androidpn project and you'll see server and client Two-part code
Server section
Locate The server code, turn on the service, double-click bin/run.bat , and listen for the 127.0.0.1:7070 Port after the service starts
Open the above connection on the browser, you can see the interface, indicating the success of the launch
Client Section
Import the code into Eclipse
View the manifest file and see the activity
Demoappactivity
Notificationdetailsactivity
Notificationsettingsactivity
There is also a service,Notificationservice
View demoappactivity
Get a button to set the Click event, launch Settings page
Start a service in the background
View Properties file, open res/raw/androidpn.properties file
Set ApiKey, it's useless here.
Set XMPP host xmpphost (xmpp is a network protocol)10.0.2.2 Server IP address
Set xmpp Port xmppport 5222
Send a notification on the server side, the client will pop up a prompt, click on the prompt, will enter the notification details screen
When we want to use it, the server-side sends there to simulate a post submission.
Client use, copy the main client code to the past,Lib/asmack.jar , the above configuration file
The XMPP Network protocol Specifies the format of client-server interaction, the protocols that are exposed on the network for network chat, and some XML strings that the client sends to the server.
The Asmack.jar jar package is The implementation of the XMPP protocol, which can stitch together those XML strings, similar to HttpClient
[Android] ANDROIDPN Open Source Project Introduction