This is my code, but it doesn't work:
private void uploadStrava() {
// Create HttpClient and Post Header
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("
https://www.strava.com/api/v3/uploads");
try {
// Add new dates
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(3);
nameValuePairs.add(new BasicNameValuePair("id", "171335"));
nameValuePairs.add(new BasicNameValuePair("file", fileName));
nameValuePairs.add(new BasicNameValuePair("data_type", "gpx"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
// Execute HTTP Post Request
HttpResponse response = httpclient.execute(httppost);
Toast.makeText(getApplicationContext(), response.getAllHeaders().toString(), Toast.LENGTH_LONG).show();
} catch (ClientProtocolException e) {
Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG).show();
} catch (IOException e) {
Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG).show();
}
}