user996428
user996428

Reputation: 96

Sharing photos from app to google+

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+?

Upvotes: 0

Views: 328

Answers (1)

Chirag Shah
Chirag Shah

Reputation: 3674

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();

Upvotes: 1

Related Questions