I am developing an android app to remotely access sharepoint online.I am able to upload files using http put method and view them but i am not able to open them.I feel i am not specifying the proper content type.Here's my code:
try {
File sdcard = Environment.getExternalStorageDirectory();
//Get the text file
File file = new File(sdcard, "gps.doc");
FileInputStream fIn = new FileInputStream(file);
BufferedReader myReader = new BufferedReader(
new InputStreamReader(fIn));
String aDataRow = "";
String aBuffer = "";
while ((aDataRow = myReader.readLine()) != null) {
aBuffer += aDataRow + "\n";
}
System.out.println(aBuffer + "content of the file");
HttpPut httpupld = new HttpPut("http://mysite.sharepoint.com/Sites/Documents/gps.doc");
StringEntity entity1 = new StringEntity(aBuffer, "HTTP.UTF_8");
httpDel.setEntity(entity1);
System.out.println(title);
HttpResponse rsp = http2.execute(httpupld);
respcode=rsp.getStatusLine().getStatusCode();
System.out.println(respcode);
} catch (Exception e) {
Log.e("Error: ", e.getMessage());
}
Any help is appreciated.Thankyou