我正在使用它从 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);
这是张贴这样的东西。
我没有指定这张图片的路径。它仍然显示在我们的服务器上。我可以指定此图片的路径吗?
如果我不使用 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/