so I have this code that gives the location of an android device and I want it to send the location after that to php web server when a button on php web application is pressed , how can I do that ??
That's an example of how to pass two parameters to a php web code and get back a String return:
URL url;
String stringReturn;
HttpURLConnection urlConnection = null;
try {
url = new URL("http://www.mydomanin.com/myphp.php?latitude=" + myLatitude + "?longitude=" + myLongitude);
urlConnection = (HttpURLConnection) url.openConnection();
InputStream in = urlConnection.getInputStream();
InputStreamReader inRead = new InputStreamReader(in);
stringReturn = IOUtils.toString(inRead);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (urlConnection != null) {
urlConnection.disconnect();
}
}