【问题标题】:Share image to Google+ in Android app?在 Android 应用中将图片分享到 Google+?
【发布时间】:2013-07-08 19:00:21
【问题描述】:

我正在开展一个项目,该项目需要将我的应用中的图片分享到 Google+。 但是当发现一些与我的问题有关的示例时,他们需要从 Google Play 安装 Google+ 来共享任何内容。 所以问题是:如何在不安装任何额外应用程序的情况下从我的应用程序共享?或者从 Google Play 安装 Google+ 是解决我的问题的唯一方法?

感谢您的关注!

【问题讨论】:

  • 是的,您确实需要在设备中安装 google plus 才能共享..
  • 检查g+是否安装errorCode = GooglePlusUtil.checkGooglePlusApp(this); If (errorCode == GooglePlusUtil.SUCCESS)然后分享图片

标签: android google-plus


【解决方案1】:

希望这对您有所帮助...

File tmpFile = new File("/path/to/image");
 final String photoUri = MediaStore.Images.Media.insertImage(
         getContentResolver(), tmpFile.getAbsolutePath(), null, null);

 Intent shareIntent = ShareCompat.IntentBuilder.from(this)
         .setText("Hello from Google+!")
         .setType("image/jpeg")
         .setStream(Uri.parse(photoUri))
         .getIntent()
         .setPackage("com.google.android.apps.plus");

Google+ 应用仅支持 content:// URI。您需要为此使用MediaStore API...

【讨论】:

  • @BhavinNattar :我尝试分享 GIF,但它只显示第一帧。如何共享 GIF 动画?
  • @EastBK:好友尝试做同样的事情,但在此之前更改代码中的这些行 .setType("image/gif")..
【解决方案2】:

如果web api 为您提供了验证用户身份并上传带有图片的帖子的方法,我想您可以随时查看。

不过,我认为,只需使用应用程序本身就可以为您省去很多麻烦。

【讨论】:

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