With the old Apache stuff deprecated in API 22, I am finally getting around to updating my network stuff.
Using openConnection()
seems pretty straight f
I fixed it like this:
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
Here is parameter stuff:
String charset = "UTF-8";
String s = "unit_type=" + URLEncoder.encode(MainActivity.distance_units, charset);
s += "&long=" + URLEncoder.encode(String.valueOf(MainActivity.mLongitude), charset);
s += "&lat=" + URLEncoder.encode(String.valueOf(MainActivity.mLatitude), charset);
s += "&user_id=" + URLEncoder.encode(String.valueOf(MyndQuest.userId), charset);
conn.setFixedLengthStreamingMode(s.getBytes().length);
PrintWriter out = new PrintWriter(conn.getOutputStream());
out.print(s);
out.close();