0

我正在尝试将图像从我的应用程序分享到社交网络。我已经实现了Facebookand Twitter,但是在Google+,我看不到任何方法。

我已经看到诸如此类的应用程序Instagram在 Google+ 上共享图像。但是,在 Google+ 开发人员中,我唯一能找到的是:

最新版本的 Google+ Android SDK,包括 SDK 工具组件(尚不可用)。

谁能告诉我如何在 Google+ 上分享我的图片?

4

1 回答 1

1

ACTION_SEND您可以有意地在 Google+ 上共享媒体(照片和相册) 。媒体可以在EXTRA_STREAM中指定,并且需要包含媒体的内容 URI

这是一个例子:

File file = new File(Environment.getExternalStorageDirectory(),
        MY_PICTURE_FILE_NAME);
String photoUri = MediaStore.Images.Media.insertImage(
        getContentResolver(), file.getAbsolutePath(), null, null);

Intent shareIntent = ShareCompat.IntentBuilder.from(MyActivity.this)
        .setText("Sharing an image on Google!")
        .setType("image/jpeg")
        .setStream(Uri.parse(photoUri))
        .getIntent();
startActivity(shareIntent);
file.delete();
于 2012-09-11T16:38:12.287 回答