Created
June 3, 2012 18:18
-
-
Save gideondsouza/2864460 to your computer and use it in GitHub Desktop.
Send a GET request to a server.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void postData(String la, String lo) { | |
// Create a new HttpClient and Post Header | |
HttpClient httpclient = new DefaultHttpClient(); | |
HttpGet htget = new HttpGet("http://<your_app_url>/Home/Book/"+la+"/"+lo); | |
try { | |
// Execute HTTP Post Request | |
HttpResponse response = httpclient.execute(htget); | |
String resp = response.getStatusLine().toString(); | |
Toast.makeText(this, resp, 5000).show(); | |
} catch (ClientProtocolException e) { | |
Toast.makeText(this, "Error", 5000).show(); | |
} catch (IOException e) { | |
Toast.makeText(this, "Error", 5000).show(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi bro, I have a android app which have the same code above ,it find the lat long coordinates using Network location , i just want to send lat long coordinates to my working server( which already have a APP which is listening on a specific port and receive all the data coming from different trackers and translates coordinates into the address )
So when i changed this line
HttpGet htget = new HttpGet("http://<your_app_url>/Home/Book/"+la+"/"+lo);
with
HttpGet htget = new HttpGet("http://180.178.168.43:6081/"+la+"/"+lo);
It send the data to my server and i can see these information on my server
At that points everything worked but my android app get stuck after sending that data,any help ??