android - Google plus 帖子中的链接和图片

标签 android android-intent google-plus interactive deep-linking

我正在使用它从 Android 在 Google Plus 上发帖。

    Intent shareIntent = new PlusShare.Builder(this)
            .setText(tripDetails)
            .setType("text/plain")
            .setContentDeepLinkId(
                    "RideShare-Post",
                    "Ride Share Buddy",
                    "Find the people around you to share your trip and save money. Chat with them and choose your best trip partner.",
                    Uri.parse("http://ridesharebuddy.com/ride_images/icon200.png"))
            .setContentUrl(Uri.parse("http://ridesharebuddy.com"))
            .getIntent();

     startActivityForResult(shareIntent, GOOGLE_PLUS_POST);

这是张贴这样的东西。 enter image description here

我没有指定这张图片的路径。它仍然显示在我们的服务器上。我可以指定此图片的路径吗?

如果我不使用 contentUrl 设置链接,它会显示在 DeepLinkId 中指定的正确图像。但是我需要为此提供链接和适当的图像。我该怎么做?

更新:

我试过@demand 的回答

 <meta content="http://www.ridesharebuddy.com/ride_images/logo.png" itemprop="thumbnailUrl" property="og:image">

它仍然没有显示正确的图像。它仍然显示相同。

请指导我正确的路径。

最佳答案

Google 从您发布的网址获取图片。据我所知,您不能发布自己的图片。要为您的网址添加图片,您需要将图片添加到您链接的页面中。 Google 支持 opengraph 和 schema.org。在这里查看来自谷歌的答案:Are there tags to specify the Google +1 story format in Google+ like og-meta for Facebook?

更新: 我的意思是你不能从你的应用程序中设置这个图像。您必须在您的服务器上执行此操作。例如在 cnn 站点上,您可以在 html 中找到此代码:<meta content="http://i2.cdn.turner.com/cnn/dam/assets/140512115559-pkg-nima-elbagir-abducted-girls-00014109-story-top.jpg" itemprop="thumbnailUrl" property="og:image">

在此页面上 http://edition.cnn.com/2014/05/12/world/africa/nigeria-boko-haram-chibok-journey/index.html?hpt=hp_c2 当您在 google plus(或 Facebook)上分享链接时,google 会转到您的链接并尝试获取此元数据。如果找到,谷歌会将其添加到您的帖子中。如何在您自己的网站上描述它,您可以在上面的链接中找到。

关于android - Google plus 帖子中的链接和图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23624538/

相关文章:

c# - 构建代理需求的问题未针对 android 构建进行验证

ios - 如何快速获取我的 gmail 联系人列表的电子邮件地址

android - 按后退按钮转到 android 主页

android - 如何打开并检查 Play Protect 是否启用或禁用

java - 使用 "onBackPressed()"使自己开始的 Activity 返回到上一个屏幕

javascript - 如何获取电子邮件地址的 Google+ 个人资料照片?

android - Android 中的 Google Plus 封面照片

android - 无法从android中的服务启动浏览器

java - Android Node.getNodeValue 在某些情况下返回 NULL

Android 应用小部件 : how to change color AND transparency of ImageView