SubscribeSubscribe with Androidlift to get new post on mail.

Android Google Plus Sharing Text, Images and Videos, Posts

Android Google Plus Sharing Text, Images and Videos, Posts

Google Plus Sharing dialog provides a means for users to share rich content from your app into the Google+ stream, including text, photos, URL attachments and location.

Before Going Ahead

You must create a Google API Console project and initialize the GoogleApiClient object. For that follow the “Google Plus Login Integration” Post’s First Step.

If you done with that then follow the below given steps for Google Plus Sharing posts, media to google+ through android application “GPlusSharingDemo”.

 

Download From Githubdownload code from github

Adding Basic Google Plus Sharing

Basic Google Plus Sharing demonstrates the minimum code that is required to add sharing to Google+ from your app. You set up sharing by using the PlusShare.Builder methods, which you later build on to add advanced sharing features.

To add sharing:

  1. Add a share button to your layout.
  2. In your activity, configure your button’s OnClickListener to share when clicked.
     

Share an image or video

The PlusShare.Builder class provides a setStream method that you can use to attach an image or video to a shared post.

The following example demonstrates using a picker intent to choose an image or video from the gallery to share on Google+ when the user clicks a button in your app.

 Note: Sharing media requires that that the Google+ app is installed on the device to handle the share intent. 

In your activity, configure your button’s OnClickListener to launch the picker intent when clicked.:

When you share media to Google+, you cannot also use the setContentUrl method. If you want to include a URL in the post with the media, you should append the URL to the prefilled text in the setText() method.


Google Plus Sharing Complete Source Code

Thank You…

(23)