【问题标题】:Sharing photos from app to google+将应用中的照片分享到 google+
【发布时间】:2023-03-28 18:33:01
【问题描述】:

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

我看到像Instagram 等应用程序在 Google+ 上分享图片。但是,在 Google+ 开发人员中,我唯一能找到的是:

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

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

【问题讨论】:

    标签: android google-plus


    【解决方案1】:

    您可以使用ACTION_SEND 意图在 Google+ 上共享媒体(照片和相册)。 媒体可以在EXTRA_STREAM内指定,需要包含媒体的content 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();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-10-15
      • 1970-01-01
      • 2012-03-11
      • 2013-04-29
      • 1970-01-01
      • 1970-01-01
      • 2014-05-17
      • 1970-01-01
      相关资源
      最近更新 更多