Gurus, I am a lil lost on this topic. Here\'s a breakdown of what I\'m trying to do.
[User/Android Device] sends location info to a server -> [server]
[serv
call the following method to connect to any url and read response data from it. What so ever the URL you will hit. Url will be of any php or asp or jsp page or in any server side scripting language. The following method has nothing do with it. what so ever the url page will return that will be entered in your Log records. check Log cat for read result
private void connectToServerAndReadData()
{
HttpURLConnection conn;
boolean result = false;
try{
// Enter any URL here you want to connect
URL url = new URL("http://php1.funnymedialinks.com/scribd/rcheck.php");
// Open a HTTP connection to the URL
conn = (HttpURLConnection) url.openConnection();
// conn.connect();
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line ;
while ((line = rd.readLine()) != null) {
Log.v("Readed Data from Server ","data- "+line);
}
rd.close();
}catch(MalformedURLException e){
e.printStackTrace();
}
catch(IOException e){
e.printStackTrace();
}
catch(Exception e){
e.printStackTrace();
}
}
You have few options actually.
i> You can access the SOAP based webservice methods implemented on the server side & call using the KSOAP API ( 3 rd party KSOAP jar needs to be added to the eclipse)
ii> You can also access RESTFul webservices implemented on the server side , which will either return you a XML or JSON as a response.
For mobile applications , better to go for RESTFul webservices which returns JSON.
Android is Java based but the Server based coding can be .NET , J2ee , Php . Actually its irrelevant to you since you need to access the webservice methods , if thinking from a mobile developer perspective.
You can setup J2ee , .NET , PHP environment with eclipse.
Kindly check the following url which can be useful to you for setting up .NET , J2ee , PHP on eclipse
http://sourceforge.net/projects/eclipsedotnet/
http://www.eclipse.org/pdt/
http://www.eclipse.org/downloads/moreinfo/jee.php
Kindly revert for any clarification.
Sounds like you need an HTTP listener running on a server that takes a request that includes the location (latitude/longitude?) of an Android device, queries a database for a list of items, and returns that back to the Android device.
You'll also have to have a database with the schema created and data loaded.
If you have all that, the HTTP listener can be as simple as a Java servlet that accepts an HTTP GET request with two parameters, one each for latitude and longitude. Or you can make it as complex as a SOAP web service with a WSDL, request and response XML.
You would package the servlet as a Java web app in a WAR and deploy it locally on your development machine using a servlet/JSP engine like Tomcat.
Your Android device would have to know how to make an HTTP connection to the server, formulate the appropriate request, and consume the response when it comes back.