简体   繁体   中英

Android device connection with server

I am developing a application in which the device scans QR code. The qrcode contains id and some textual information. Based upon some specific information some button gets highlighted. When user clicks on that button the qrcode id is stored in json and and then the connection is made to the server. The server decodes this information and then put some information into jason and send back to the device......and device again decode that information. The server application is to be written in struts 2 . Now my question is how should i write the connection establishment between the device and server.

You can use built-in Apache HTTP client. As the format is JSON and server will be in Struts, it will be a matter of simple HTTP POST. See this example: http://www.androidsnippets.com/executing-a-http-post-request-with-httpclient

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM