Google+ Domains API attach several photos to Activity

56 Views Asked by At

I use Google+ Domains API for creating posts via GSuite accounts. Before create a post all photos should be uploaded to the cloud. I use this function

Media mediaDescription = new Media();
PlusDomains.Media.Insert insertRequest = plusDomains.media().insert("me", "cloud", mediaDescription, new FileContent("image/jpeg", file));
Media result = insertRequest.execute();
String mediaId = result.getId();
Activity.PlusDomainsObject.Attachments attachment = new Activity.PlusDomainsObject.Attachments();
attachment.setObjectType("photo");// Or set to "video" for uploaded videos
attachment.setId(mediaId);

and store all attachment's

After that I add all attachments to the activity and send it to the API method

Activity activity = new Activity();
activity.setObject(new Activity.PlusDomainsObject());
activity.getObject().setAttachments(attachments);

plusDomains.activities().insert("me", activity).execute();

I got a successful response with ID of created Activity on the Google Plus.

But the post contains only the last attached mediaId

All functionality created regarding official documentation from this link https://developers.google.com/+/domains/posts/attaching-media

0

There are 0 best solutions below