belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1
ShortcutManagerCompat
public class ShortcutManagerCompat
extends Object
java.lang.Object | |
↳ | android.support.v4.content.pm.ShortcutManagerCompat |
Helper for accessing features in ShortcutManager
.
Summary
Public methods | |
---|---|
static Intent | createShortcutResultIntent(Context context, ShortcutInfoCompat shortcut) Returns an Intent which can be used by the launcher to pin shortcut. |
static boolean | isRequestPinShortcutSupported(Context context) |
static boolean | requestPinShortcut(Context context, ShortcutInfoCompat shortcut, IntentSender callback) Request to create a pinned shortcut. |
Inherited methods | |
---|---|
![]() java.lang.Object |
Public methods
createShortcutResultIntent
Intent createShortcutResultIntent (Context context, ShortcutInfoCompat shortcut)
Returns an Intent which can be used by the launcher to pin shortcut.
This should be used by an Activity to set result in response to ACTION_CREATE_SHORTCUT
.
Parameters | |
---|---|
context | Context |
shortcut | ShortcutInfoCompat : new shortcut to pin |
Returns | |
---|---|
Intent | the intent that should be set as the result for the calling activity |
See also:
isRequestPinShortcutSupported
boolean isRequestPinShortcutSupported (Context context)
Parameters | |
---|---|
context | Context |
Returns | |
---|---|
boolean | true if the launcher supports requestPinShortcut(Context, ShortcutInfoCompat, IntentSender) , false otherwise |
requestPinShortcut
boolean requestPinShortcut (Context context, ShortcutInfoCompat shortcut, IntentSender callback)
Request to create a pinned shortcut.
On API <= 25 it creates a legacy shortcut with the provided icon, label and intent. For newer APIs it will create a ShortcutInfo
object which can be updated by the app.
Use getIntentSender()
to create a IntentSender
.
Parameters | |
---|---|
context | Context |
shortcut | ShortcutInfoCompat : new shortcut to pin |
callback | IntentSender : if not null, this intent will be sent when the shortcut is pinned |
Returns | |
---|---|
boolean | true if the launcher supports this feature |