Android Client Server communication

爱⌒轻易说出口 提交于 2019-12-18 14:50:01

问题


I have an application in Android which get latitude and longitude from GPS. I want to send these lat and long to server at particular port and want to receive the response of server into my Android application.

Kindly give the direction so that I can make it possible.


回答1:


There are many ways to perform this data transfer using the Android platform.

My preference is to use JSON to communicate between the App and the server. For an example of how to implement this in your app read through this article: http://www.josecgomez.com/2010/04/30/android-accessing-restfull-web-services-using-json/




回答2:


If you want to upload some information to web server, simple way is to use GET method in your web server part. you may pass two parameter latitude + longitude to server.

Second thing is to communicate with server to mobile device. Better way is to use JSON format to communicate between them. Try to understand the JSON format and implement it.



来源:https://stackoverflow.com/questions/5150779/android-client-server-communication

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!