Pregunta

I am using this to post on Google Plus from Android.

    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. enter image description here

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. 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

 <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.

¿Fue útil?

Solución

Google get image from url, which you posted. 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. Look at the answer from google here: Are there tags to specify the Google +1 story format in Google+ like 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">

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. If it found, google will add it to your post. How to describe it on your own website you can find on the link above.

Otros consejos

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);
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top