Hello again I've really stuck with this, let me be more exact on how I'm trying to accomplish image retrieval from contact profile in google contacts.
I'm sure it is correct, and I'm sure I've got correct auth parameters and access token because I CAN RETRIEVE CONTACT ENTRIES, DOCS ENTRIES and everything I want.
After retrieving contact full profile I'm executing code to retrieve image for that contact:
ContactEntry entry = service.getEntry(contactURL,ContactEntry.class);
Link photoLink = entry.getContactPhotoLink();
if (photoLink !=null && photoLink.getEtag()!=null)
{
GDataRequest request = service.createLinkQueryRequest(photoLink);
request.execute(); // No Authentication header information
InputStream stream = req.getResponseStream();
}
Execution is broken and exception with message "No Authentication header information" is raised.
Ok so I'm thinking.. Hmmmmmmmm Hmmmmmmmm Hmmmmmm maybe there is a bug in api. Maybe I should switch to more low level approach...
Let us try with auth post and UrlFetch:
GoolgeOAuthParameters oauthParameters = tokenManager.getAuthParameters(email);OAuthConsumer consumer = new DefaultOAuthConsumer(oauthParameters.getOAuthToken(),oauthParameters.getOAuthTokenSecret);URL url = new URL(resource);HttpURLConnection request = (HttpURLConnection)url.openConnection();consumer.sign(request);request.connect();request.getInputStream();
The exeption is now slightly different - the message is 401 unauthorized access but I'm sure the reason is the same.
So now I would like to ask the people who are managed to fetch image.. How do You succedeed ?
Api
gdata-contacts-3.0-1.41.5.jar
gdata-core-1.0-1.41.5.jar
gdata-base-1.0-1.41.5.jar
gdata-client-1.0-1.41.5 jar