android send location details to servlet via gps

好久不见. 提交于 2020-01-07 05:21:05

问题


i am newbie to Android..i have latitude and longitude details in my program..i want to send them to web server via gps..and those details should be saved in a database and retrieve them whenever i require..plz explain me how to do..and if possible give me some sample code...


回答1:


Did you mean the mobile network or wireless instead of GPS ?

Anyway:

You from the sounds of it you need to get the GPS details into your program then pass them to your server. Have you designed your webserver yet or are you going to be submitting this to a site that already exists?




回答2:


You can't "send" something "via GPS". GPS is a "receive-only" thing.

http://en.wikipedia.org/wiki/Global_Positioning_System

If you like to send data to a web server, you can use the HTTP-protocol with Android, e.g. retrieve latitude and longitude (How to get Latitude and Longitude of the mobile device in android?) and then use HttpGet (or HttpPost):

http://developer.android.com/reference/org/apache/http/client/methods/HttpGet.html




回答3:


You're really asking for a lot, but lets see if we can point you in the right directions.

Here is a great example of reading GPS data from an Android device: LocationManager example

You must declare explicitly in Android that your app needs permission to access the Internet (and the GPS, for that matter). Android Securty and Permissions

There are also some specific ways of life in Android development. The official developer's guide is a good place to start. The Android Developer's Guide



来源:https://stackoverflow.com/questions/5105871/android-send-location-details-to-servlet-via-gps

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