Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Spreadsheet API - Java - com.google.gdata.util.ParseException: Unrecognized content type:application/binary

I am using Google Spreadsheet API in my simple Android application. This is the piece of code:

URL spreadSheetUrl = new URL("https://spreadsheets.google.com/feeds/spreadsheets/private/full");
SpreadsheetQuery query = new SpreadsheetQuery(spreadSheetUrl);
query.setTitleQuery("xyz");
query.setTitleExact(true);
SpreadsheetFeed spreadSheetFeed = service.getFeed(query, SpreadsheetFeed.class);

This piece of code is called from my application's sync adapter.

I am getting this error:

com.google.gdata.util.ParseException: Unrecognized content type:application/binary
com.google.gdata.client.Service.parseResponseData(Service.java:2136)
com.google.gdata.client.Service.parseResponseData(Service.java:2098)
com.google.gdata.client.Service.getFeed(Service.java:1136)
com.google.gdata.client.Service.getFeed(Service.java:1077)
com.google.gdata.client.GoogleService.getFeed(GoogleService.java:676)
com.google.gdata.client.Service.getFeed(Service.java:1034)

Can someone suggest how I can solve this issue?

like image 796
user1700184 Avatar asked Dec 28 '13 23:12

user1700184


1 Answers

It turns out that I did not set the user credentials before executing this piece of code.

service.setUserCredentials(user, password);

Adding this line helped solve this issue. Weird.

like image 97
user1700184 Avatar answered Oct 17 '22 00:10

user1700184