public class

DocumentSharingIntentHelper

extends Object
java.lang.Object
   ↳ com.pspdfkit.document.sharing.DocumentSharingIntentHelper

Class Overview

Helper for creating share intents.

Summary

Constants
String MIME_TYPE_PDF PDF mime type.
Public Constructors
DocumentSharingIntentHelper()
Public Methods
static Intent createChooser(List<Intent> targetIntents, CharSequence title)
Convenience function for creating a ACTION_CHOOSER Intent.
static Intent getShareIntent(Context context, Uri shareUri, ShareTarget shareTarget)
Creates share intent for sharing shareUri to given shareTarget.
static Intent getShareIntent(Context context, Uri shareUri, ShareAction shareAction)
Creates share intent for sharing shareUri using given shareAction.
static List<Intent> getShareIntents(Context context, Uri shareUri, ShareAction... shareActions)
Generates list of sharing intents for all apps supporting given ShareAction.
static Observable<List<Intent>> getShareIntentsAsync(Context context, Uri shareUri, ShareAction shareAction)
Generates list of sharing intents for all apps supporting given ShareAction asynchronously.
static ShareTarget getShareTarget(Context context, ShareAction shareAction, String targetPackageName)
Creates ShareTarget for given shareAction and targetPackageName.
static ShareTarget getShareTarget(Context context, ShareAction shareAction, String targetPackageName, String sharedFileName)
Creates ShareTarget for given shareAction and targetPackageName.
static List<ShareTarget> getShareTargets(Context context, List<Intent> intents)
Generates list of share targets for all apps handling given intents.
static Observable<List<ShareTarget>> getShareTargetsAsync(Context context, List<Intent> intents)
Generates list of share targets for all apps handling given intents.
static Intent getShareTextIntent(String text)
Generates intent for sharing plain text.
static List<Intent> queryMailToActivities(Context context, Intent intent)
Retrieve all intents to email clients that can be target for the given intent.
static void showShareTargetDetails(Context context, ShareTarget shareTarget)
Show application details settings screen for given share target.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String MIME_TYPE_PDF

PDF mime type.

Constant Value: "application/pdf"

Public Constructors

public DocumentSharingIntentHelper ()

Public Methods

public static Intent createChooser (List<Intent> targetIntents, CharSequence title)

Convenience function for creating a ACTION_CHOOSER Intent. Builds a new ACTION_CHOOSER Intent that wraps the given target intent, also optionally supplying a title.

Returns
  • Final chooser intent or null if targetIntents was empty

public static Intent getShareIntent (Context context, Uri shareUri, ShareTarget shareTarget)

Creates share intent for sharing shareUri to given shareTarget.

public static Intent getShareIntent (Context context, Uri shareUri, ShareAction shareAction)

Creates share intent for sharing shareUri using given shareAction.

public static List<Intent> getShareIntents (Context context, Uri shareUri, ShareAction... shareActions)

Generates list of sharing intents for all apps supporting given ShareAction.

Note: this call may block for a while and should not be invoked on the main thread.

Parameters
shareUri Uri that we want to share.
shareActions Share actions that should be used.

public static Observable<List<Intent>> getShareIntentsAsync (Context context, Uri shareUri, ShareAction shareAction)

Generates list of sharing intents for all apps supporting given ShareAction asynchronously.

Parameters
context Context to use.
shareUri Uri that we want to share.
shareAction Share actions that should be used.
Returns
  • Observable emitting list of sharing intents.

public static ShareTarget getShareTarget (Context context, ShareAction shareAction, String targetPackageName)

Creates ShareTarget for given shareAction and targetPackageName.

Parameters
context The context to use.
shareAction Share action to create share target for.
targetPackageName Package name of share target.
Returns

public static ShareTarget getShareTarget (Context context, ShareAction shareAction, String targetPackageName, String sharedFileName)

Creates ShareTarget for given shareAction and targetPackageName.

Parameters
context The context to use.
shareAction Share action to create share target for.
targetPackageName Package name of share target.
sharedFileName File name of the file that should be shared.
Returns

public static List<ShareTarget> getShareTargets (Context context, List<Intent> intents)

Generates list of share targets for all apps handling given intents.

Note: this call may block for a while and should not be invoked on the main thread.

Parameters
intents Intents used for sharing.

public static Observable<List<ShareTarget>> getShareTargetsAsync (Context context, List<Intent> intents)

Generates list of share targets for all apps handling given intents.

Parameters
intents Intents used for sharing.
Returns
  • Observable emitting list of share targets.

public static Intent getShareTextIntent (String text)

Generates intent for sharing plain text.

Parameters
text Text to be shared.

public static List<Intent> queryMailToActivities (Context context, Intent intent)

Retrieve all intents to email clients that can be target for the given intent.

Parameters
context Context of the calling component.
intent Intent for querying possible email clients targeting this intent.

public static void showShareTargetDetails (Context context, ShareTarget shareTarget)

Show application details settings screen for given share target.

Parameters
context The context to use.
shareTarget Share target for which to display app details.