简体   繁体   English

如何通过G + Android SDK在Google+上的一篇文章中上传多张照片?

[英]How can I upload multiple photos in one post on Google+ from G+ Android SDK?

I want to know how to upload multiple photos at a time thru google plus ? 我想知道如何通过Google Plus一次上传张照片吗?

I found how to upload one photo and one message at a time from google plus sample code. 我发现了如何一次从Google上载一张照片和一条消息以及示例代码。

String action = "/?view=true";
Uri callToActionUrl = Uri.parse(getString(R.string.plus_example_deep_link_url) + action);
String callToActionDeepLinkId = getString(R.string.plus_example_deep_link_id) + action;

// Create an interactive post builder.
builder = new PlusShare.Builder(this, plusClient);

// Set call-to-action metadata.
builder.addCallToAction(LABEL_VIEW_ITEM, callToActionUrl, callToActionDeepLinkId);

// Set the target url (for desktop use).
builder.setContentUrl(Uri.parse(getString(R.string.plus_example_deep_link_url)));

// Set the target deep-link ID (for mobile use).
builder.setContentDeepLinkId(getString(R.string.plus_example_deep_link_id),
        null, null, null);

// Set the message.
builder.setText("user message");

// Set the image
Uri uri = Uri.fromFile(new File("[user file path]"));
builder.setStream(uri);

Anyone knows about uploading multiple photos like facebook and twitter? 有人知道要上传多张照片(例如Facebook和Twitter)吗?

It should work with addStream() method, unfortunately... it doesn't work. 不幸的是,它应该与addStream()方法一起使用……不起作用。 Indeed it makes the application crash. 确实,它使应用程序崩溃。

After a long search, I finally got it: it's not possible if using the simplified G+ SDK! 经过长时间的搜索,我终于明白了:使用简化的G + SDK是不可能的! (the one dedicated to Android). (专用于Android的一种)。

There is a second one, included in the Google API family that you can find there: 您可以在Google API系列中找到第二个:

http://code.google.com/p/google-api-java-client/wiki/APIs#Google+_API http://code.google.com/p/google-api-java-client/wiki/APIs#Google+_API

This one will let you build more advanced post, included, several pic one. 这一篇将让您建立更高级的帖子,包括几个图片。

Unfortunately the second SDK is much more low level, not dedicated to Android, it's a kind of Java abstraction over http request. 不幸的是,第二个SDK的级别要低得多,而不是专用于Android,它是对HTTP请求的一种Java抽象。

Regards 问候

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM