ShareCompat.IntentReader

public static class ShareCompat.IntentReader
extends Object

java.lang.Object
   ↳ androidx.core.app.ShareCompat.IntentReader


IntentReader is a helper for reading the data contained within a sharing (ACTION_SEND) Intent. It provides methods to parse standard elements included with a share in addition to extra metadata about the app that shared the content.

Social sharing apps are encouraged to provide attribution for the app that shared the content. IntentReader offers access to the application label, calling activity info, and application icon of the app that shared the content. This data may have been provided voluntarily by the calling app and should always be displayed to the user before submission for manual verification. The user should be offered the option to omit this information from shared posts if desired.

Activities that intend to receive sharing intents should configure an intent-filter to accept Intent.ACTION_SEND intents ("android.intent.action.SEND") and optionally accept Intent.ACTION_SEND_MULTIPLE ("android.intent.action.SEND_MULTIPLE") if the activity is equipped to handle multiple data streams.

Summary

Public constructors

IntentReader(Activity activity)

Create an IntentReader for parsing and interpreting the sharing intent used to start the given activity.

IntentReader(Context context, Intent intent)

Create an IntentReader for parsing and interpreting the given sharing intent.

Public methods

static ShareCompat.IntentReader from(Activity activity)

This method is deprecated. Use the constructor of IntentReader instead

ComponentName getCallingActivity()

Get the ComponentName of the Activity that invoked this sharing intent.

Drawable getCallingActivityIcon()

Get the icon of the calling activity as a Drawable if data about the calling activity is available.

Drawable getCallingApplicationIcon()

Get the icon of the calling application as a Drawable if data about the calling package is available.

CharSequence getCallingApplicationLabel()

Get the human-readable label (title) of the calling application if data about the calling package is available.

String getCallingPackage()

Get the name of the package that invoked this sharing intent.

String[] getEmailBcc()

Get an array of Strings, each an email address to BCC on this share.

String[] getEmailCc()

Get an array of Strings, each an email address to CC on this share.

String[] getEmailTo()

Get an array of Strings, each an email address to share to.

String getHtmlText()

Get the styled HTML text shared with the target activity.