Skip to content

Most visited

Recently visited

navigation

LauncherApps.PinItemRequest

public static final class LauncherApps.PinItemRequest
extends Object implements Parcelable

java.lang.Object
   ↳ android.content.pm.LauncherApps.PinItemRequest


Represents a "pin shortcut" or a "pin appwidget" request made by an app, which is sent with an ACTION_CONFIRM_PIN_SHORTCUT or ACTION_CONFIRM_PIN_APPWIDGET intent respectively to the default launcher app.

Note the launcher may receive a request to pin a shortcut that is already pinned, because the user may actually want to have multiple icons of the same shortcut on the launcher. The launcher can tell this case by calling isPinned() on the shortcut returned by getShortcutInfo(). In this case, calling accept() is optional; even if the launcher does not call it, the shortcut is already pinned. Also in this case, the options argument to accept(Bundle) will be ignored.

For AppWidget pin requests launcher should send back the appwidget id as an extra for accept(Bundle) as EXTRA_APPWIDGET_ID.

See also:

Summary

Constants

int REQUEST_TYPE_APPWIDGET

This is a request to pin app widget.

int REQUEST_TYPE_SHORTCUT

This is a request to pin shortcut.

Inherited constants

From interface android.os.Parcelable

Fields

public static final Creator<LauncherApps.PinItemRequest> CREATOR

Public methods

boolean accept(Bundle options)

Called by the receiving launcher app when the user accepts the request.

boolean accept()

Same as as accept(Bundle) with no options.

int describeContents()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

AppWidgetProviderInfo getAppWidgetProviderInfo(Context context)

AppWidgetProviderInfo sent by the requesting app.

int getRequestType()

Represents the type of a request.

ShortcutInfo getShortcutInfo()

ShortcutInfo sent by the requesting app.

boolean isValid()

Return TRUE if a request is valid -- i.e.

void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Inherited methods

From class java.lang.Object
From interface android.os.Parcelable

Constants

REQUEST_TYPE_APPWIDGET

int REQUEST_TYPE_APPWIDGET

This is a request to pin app widget.

Constant Value: 2 (0x00000002)

REQUEST_TYPE_SHORTCUT

int REQUEST_TYPE_SHORTCUT

This is a request to pin shortcut.

Constant Value: 1 (0x00000001)

Fields

Public methods

accept

boolean accept (Bundle options)

Called by the receiving launcher app when the user accepts the request.

Parameters
options Bundle
Returns
boolean

accept

boolean accept ()

Same as as accept(Bundle) with no options.

Returns
boolean

describeContents

int describeContents ()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(Parcel, int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Returns
int a bitmask indicating the set of special object types marshaled by this Parcelable object instance.

getAppWidgetProviderInfo

AppWidgetProviderInfo getAppWidgetProviderInfo (Context context)

AppWidgetProviderInfo sent by the requesting app. Always non-null for a REQUEST_TYPE_APPWIDGET request.

Parameters
context Context
Returns
AppWidgetProviderInfo

getRequestType

int getRequestType ()

Represents the type of a request. For now REQUEST_TYPE_SHORTCUT is the only valid type.

Returns
int

getShortcutInfo

ShortcutInfo getShortcutInfo ()

ShortcutInfo sent by the requesting app. Always non-null for a REQUEST_TYPE_SHORTCUT request.

Returns
ShortcutInfo

isValid

boolean isValid ()

Return TRUE if a request is valid -- i.e. accept(Bundle) has not been called yet.

Returns
boolean

writeToParcel

void writeToParcel (Parcel dest, 
                int flags)

Flatten this object in to a Parcel.

Parameters
dest Parcel: The Parcel in which the object should be written.
flags int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.