Quicknav Quicknav
Links

- Google Play Developer Console
- Android Developers Blog
- About Android

Android Sites

- Android.com
- Android Developers
- Android Open Source Project

close

- - Get Started
  - Style
  - Patterns
  - Building Blocks
  - Downloads
  - Videos
- - Training
  - API Guides
  - Reference
  - Tools
    - Get the SDK
  - Google Services
- - Google Play
  - Publishing
  - Promoting
  - App Quality
  - Spotlight
  - Open Distribution

## Results

Loading...
Summary: Ctors | Methods | Inherited Methods | [Expand All]
public static class

# PlusShare.Builder

extends Object

java.lang.Object
↳ | com.google.android.gms.plus.PlusShare.Builder

## Summary

Public Constructors
| PlusShare.Builder(Context context) Create a new Builder for launching a sharing action from the given context.
| PlusShare.Builder(Activity launchingActivity) Create a new Builder for launching a sharing action from launchingActivity.
| PlusShare.Builder(Activity launchingActivity, PlusClient plusClient) This constructor is deprecated. Please migrate to `PlusShare.Builder(Activity)`, the PlusClient is optional.

Public Methods
PlusShare.Builder | addCallToAction(String label, Uri uri, String deepLinkId) Adds a call-to-action button for an interactive post.
PlusShare.Builder | addStream(Uri streamUri) Add a stream URI to the data that should be shared.
Intent | getIntent() Retrieve the Intent as configured so far by the Builder.
PlusShare.Builder | setContentDeepLinkId(String deepLinkId, String title, String description, Uri thumbnailUri) Include a deep-link ID to a resource to share on Google+.
PlusShare.Builder | setContentDeepLinkId(String deepLinkId) Include a deep-link URI of a resource to share on Google+.
PlusShare.Builder | setContentUrl(Uri uri) Sets a URL to link to from the content on the web.
PlusShare.Builder | setRecipients(List<Person> recipientList) Deprecated, use the constructor `PlusShare.Builder(Activity)` and call `setRecipients(Person, List<Person>)`.
PlusShare.Builder | setRecipients(Person user, List<Person> recipientList) Sets a list of people to send the interactive post to.
PlusShare.Builder | setStream(Uri streamUri) Set a stream URI to the data that should be shared.
PlusShare.Builder | setText(CharSequence text) Set a pre-filled message to be sent as part of the share.
PlusShare.Builder | setType(String mimeType) Set the type of data being shared.

[Expand] Inherited Methods

From class java.lang.Object

Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)

## Public Constructors

#### public PlusShare.Builder (Context context)

Create a new Builder for launching a sharing action from the given context.

##### Parameters

context | Context that the share will be launched from

#### public PlusShare.Builder (Activity launchingActivity)

Create a new Builder for launching a sharing action from launchingActivity.

##### Parameters

launchingActivity | Activity that the share will be launched from

#### public PlusShare.Builder (Activity launchingActivity, PlusClient plusClient)

This constructor is deprecated.
Please migrate to `PlusShare.Builder(Activity)`, the PlusClient is optional.

## Public Methods

#### public PlusShare.Builder addCallToAction (String label, Uri uri, String deepLinkId)

Adds a call-to-action button for an interactive post. To use this method, you must have passed a signed-in PlusClient to the Builder.Builder(Activity, PlusClient) constructor or an `IllegalStateException` will be thrown.

##### Parameters

label | The call-to-action label. Choose a value from the list of list
uri | The URL to link to when the user clicks the call-to-action. This parameter is required.
deepLinkId | A deep-link ID to send to mobile clients when the user clicks the call-to-action. This parameter is optional.

#### public PlusShare.Builder addStream (Uri streamUri)

Add a stream URI to the data that should be shared. If this is not the first stream URI added the final intent constructed will become an ACTION_SEND_MULTIPLE intent. Not all apps will handle both ACTION_SEND and ACTION_SEND_MULTIPLE.

##### Parameters

streamUri | URI of the stream to share.

##### Returns

- This Builder for method chaining.

##### See Also

- `EXTRA_STREAM`
- `ACTION_SEND`

#### public Intent getIntent ()

Retrieve the Intent as configured so far by the Builder.

##### Returns

- The current Intent being configured by this builder

#### public PlusShare.Builder setContentDeepLinkId (String deepLinkId, String title, String description, Uri thumbnailUri)

Include a deep-link ID to a resource to share on Google+.

##### Parameters

deepLinkId | The deep-link ID to a resource to share on Google+. This parameter is required.
title | The title of the resource. Used if there is no content URL to display. This parameter is optional.
description | The description of a resource. Used if there is no content URL to display. This parameter is optional.
thumbnailUri | The thumbnailUri for a resource. Used if there is no content URL to display. This parameter is optional.

##### Returns

- This Builder for method chaining.

#### public PlusShare.Builder setContentDeepLinkId (String deepLinkId)

Include a deep-link URI of a resource to share on Google+.

##### Parameters

deepLinkId | The deep-link ID to a resource to share on Google+. This parameter is required.

##### Returns

- This Builder for method chaining.

#### public PlusShare.Builder setContentUrl (Uri uri)

Sets a URL to link to from the content on the web. The content URL is required when used in conjunction with `addCallToAction(String, Uri, String)` to build an interactive post, and to provide the user context for the call-to-action button.

##### Parameters

uri | the URL to link to on the web.

##### Returns

- This Builder for method chaining.

#### public PlusShare.Builder setRecipients (List<Person> recipientList)

Deprecated, use the constructor `PlusShare.Builder(Activity)` and call `setRecipients(Person, List<Person>)`. Sets a list of people to send the interactive post to.

This sets the initial people to share with, but the user can change who the post is shared with before posting. A maximum of ten recipients are allowed.

##### Parameters

recipientList | A list of recipients. See `loadPeople(PlusClient.OnPeopleLoadedListener, String...)` and `createPerson(String, String)`.

##### Returns

- This Builder for method chaining.

#### public PlusShare.Builder setRecipients (Person user, List<Person> recipientList)

Sets a list of people to send the interactive post to.

This sets the initial people to share with, but the user can change who the post is shared with before posting. A maximum of ten recipients are allowed.

##### Parameters

user | The user to send the post as, see `getCurrentPerson(com.google.android.gms.common.api.GoogleApiClient)`.
recipientList | A list of recipients. See `loadPeople(PlusClient.OnPeopleLoadedListener, String...)` and `createPerson(String, String)`.

##### Returns

- This Builder for method chaining.

#### public PlusShare.Builder setStream (Uri streamUri)

Set a stream URI to the data that should be shared.

This replaces all currently set stream URIs and will produce a single-stream ACTION_SEND intent.

##### Parameters

streamUri | URI of the stream to share

##### Returns

- This Builder for method chaining

##### See Also

- `EXTRA_STREAM`

#### public PlusShare.Builder setText (CharSequence text)

Set a pre-filled message to be sent as part of the share. This may be a styled CharSequence.

##### Parameters

text | Text to share

##### Returns

- This Builder for method chaining

##### See Also

- `EXTRA_TEXT`

#### public PlusShare.Builder setType (String mimeType)

Set the type of data being shared.

##### Parameters

mimeType | mimetype of the shared data

##### Returns

- This Builder for method chaining

##### See Also

- `setType(String)`