We are developing an Android Application to download files from Google Doc.We were able to list the files using Google Docs List APIs. Also we were able to download spreadsheet files from google docs. But when we tried to download pdf file from google docs it always returns with 401 error. This is the code snipped we are using to download the file.
CommonsHttpOAuthConsumer consumer = new CommonsHttpOAuthConsumer(C.OAuth.CONSUMER_KEY, C.OAuth.CONSUMER_SECRET);
consumer.setMessageSigner(new HmacSha1MessageSigner());
consumer.setTokenWithSecret(token, secret);
.........
String url1 = consumer.sign(obj.url+"&exportFormat=txt"); // Create complete url
get.setURI(URI.create(url1));
response = client.execute(get);
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK)
{
Log.v("GDATA MAIN", "not error");
}
else
{
Log.v("GDATA MAIN", "error"+response.getStatusLine().getStatusCode());
}
This is the URL that i generate to download the file.
Any guess, why we are not able to download PDF, but spreadsheet formats are working ?