简体   繁体   English

Google Plus帖子中的链接和图片

[英]link and image in Google plus post

I am using this to post on Google Plus from Android. 我正在用它发布来自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);

This is posting something like this. 这是发布这样的事情。 在此处输入图片说明

I haven't specified this image's path. 我尚未指定此图片的路径。 Still it's displaying from our server. 仍然从我们的服务器显示。 Can I specify path for this image? 我可以为此图像指定路径吗?

It displays proper image specified in DeepLinkId if I don't use contentUrl to set link. 如果我不使用contentUrl设置链接,它将显示DeepLinkId中指定的正确图像。 But I need to have link as well as proper image for this. 但是我需要具有链接以及正确的图像。 How I can do this? 我该怎么做?

UPDATE: 更新:

I tried with this as answered by @demand 我尝试了@demand的回答

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

Still It's not displaying proper image. 仍然没有显示正确的图像。 It still displays same. 它仍然显示相同。

Please guide me to correct path. 请指导我正确的路径。

Google get image from url, which you posted. Google从您发布的网址中获取图片。 You can't post your own image as I know. 据我所知,您无法发布自己的图片。 To add image for your url you need to add image into page which you linked. 要为您的网址添加图片,您需要在链接的页面中添加图片。 Google supports opengraph and schema.org. Google支持opengraph和schema.org。 Look at the answer from google here: Are there tags to specify the Google +1 story format in Google+ like og-meta for Facebook? 在这里查看google的答案: 是否有标签用于指定Google+中的Google +1故事格式,例如og-meta for Facebook?

UPDATE: I mean you can't set this image from your app. 更新:我的意思是您不能从您的应用程序设置此图像。 You must do it on your server. 您必须在服务器上执行此操作。 For example on cnn site you can find this code in 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"> 例如,在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">

on this page http://edition.cnn.com/2014/05/12/world/africa/nigeria-boko-haram-chibok-journey/index.html?hpt=hp_c2 When you share link on google plus (or Facebook), google go to your link and try to fetch this meta. 在此页面上http://edition.cnn.com/2014/05/12/world/africa/nigeria-boko-haram-chibok-journey/index.html?hpt=hp_c2当您在Google Plus(或Facebook)上共享链接时),Google转到您的链接并尝试获取此元数据。 If it found, google will add it to your post. 如果找到,Google会将其添加到您的帖子中。 How to describe it on your own website you can find on the link above. 您可以在上面的链接中找到如何在自己的网站上对其进行描述。

Do this way 这样做

PlusShare.Builder mPlusShareBuilder = new PlusShare.Builder(getApplicationContext());
                    mPlusShareBuilder.setType("text/plain");
                    mPlusShareBuilder.setText("your Message here");
                    mPlusShareBuilder.setContentUrl(Uri.parse("your Link here"));
                    Intent shareIntent = mPlusShareBuilder.getIntent();
                    startActivityForResult(shareIntent, REQUEST_CODE_SHARE);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM