0

I am trying to share images from my app to social networks. I have implemented Facebook and Twitter, but at Google+, I can't see any way.

I have seen apps like Instagram etc. share images on Google+. However, on Google+ developers the only thing that I can find is this:

The latest version of the Google+ Android SDK, including the SDK Tools component (not yet available).

Can anyone please show me how I can share my images on Google+?

mimming
  • 13,974
  • 3
  • 45
  • 74
user996428
  • 96
  • 1
  • 7

1 Answers1

1

You can share media (photos and albums) on Google+ with the ACTION_SEND intent. The media can be specified within the EXTRA_STREAM, and needs to contain the content URI of the media.

Here's an example:

File file = new File(Environment.getExternalStorageDirectory(),
        MY_PICTURE_FILE_NAME);
String photoUri = MediaStore.Images.Media.insertImage(
        getContentResolver(), file.getAbsolutePath(), null, null);

Intent shareIntent = ShareCompat.IntentBuilder.from(MyActivity.this)
        .setText("Sharing an image on Google!")
        .setType("image/jpeg")
        .setStream(Uri.parse(photoUri))
        .getIntent();
startActivity(shareIntent);
file.delete();
Community
  • 1
  • 1
Chirag Shah
  • 3,654
  • 22
  • 29