# ShortcutInfo.Builder

Added in[API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Builder

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder "View this page in Java")  

```
class Builder
```

|---|------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                     ||
| ↳ | [android.content.pm.ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) |

Builder class for[ShortcutInfo](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo)objects.

## Summary

|                                                                                                                                                                           Public constructors                                                                                                                                                                           ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#Builder(android.content.Context,%20kotlin.String))`(`context:` `[Context](https://developer.android.com/reference/kotlin/android/content/Context.html#)!`, `id:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Constructor. |

|                                                                                                                                                                                                                                                                                                                      Public methods                                                                                                                                                                                                                                                                                                                      ||
|---------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | [addCapabilityBinding](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#addCapabilityBinding(android.content.pm.Capability,%20android.content.pm.CapabilityParams))`(`capability:` `[Capability](https://developer.android.com/reference/kotlin/android/content/pm/Capability)`, `capabilityParams:` `[CapabilityParams](https://developer.android.com/reference/kotlin/android/content/pm/CapabilityParams)?`)` Associates a shortcut with a capability, and a parameter of that capability. |
| open[ShortcutInfo](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo)                  | [build](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#build())`()` Creates a[ShortcutInfo](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo)instance.                                                                                                                                                                                                                                                                                                        |
| open[ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | [setActivity](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#setActivity(android.content.ComponentName))`(`activity:` `[ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)`)` Sets the target activity.                                                                                                                                                                                                                                     |
| open[ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | [setCategories](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#setCategories(kotlin.collections.MutableSet))`(`categories:` `[MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!>!`)` Sets categories for a shortcut.                                                                                                                                   |
| open[ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | [setDisabledMessage](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#setDisabledMessage(kotlin.CharSequence))`(`disabledMessage:` `[CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)`)` Sets the message that should be shown when the user attempts to start a shortcut that is disabled.                                                                                                                                                       |
| open[ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | [setExcludedFromSurfaces](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#setExcludedFromSurfaces(kotlin.Int))`(`surfaces:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Sets which surfaces a shortcut will be excluded from.                                                                                                                                                                                                                             |
| open[ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | [setExtras](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#setExtras(android.os.PersistableBundle))`(`extras:` `[PersistableBundle](https://developer.android.com/reference/kotlin/android/os/PersistableBundle.html#)`)` Extras that the app can set for any purpose.                                                                                                                                                                                                                      |
| open[ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | [setIcon](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#setIcon(android.graphics.drawable.Icon))`(`icon:` `[Icon](https://developer.android.com/reference/kotlin/android/graphics/drawable/Icon.html#)!`)` Sets an icon of a shortcut.                                                                                                                                                                                                                                                     |
| open[ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | [setIntent](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#setIntent(android.content.Intent))`(`intent:` `[Intent](https://developer.android.com/reference/kotlin/android/content/Intent.html#)`)` Sets the intent of a shortcut.                                                                                                                                                                                                                                                           |
| open[ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | [setIntents](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#setIntents(kotlin.Array))`(`intents:` `[Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)<[Intent](https://developer.android.com/reference/kotlin/android/content/Intent.html#)!>`)` Sets multiple intents instead of a single intent, in order to launch an activity with other activities in back stack.                                                                                          |
| open[ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | [setLocusId](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#setLocusId(android.content.LocusId))`(`locusId:` `[LocusId](https://developer.android.com/reference/kotlin/android/content/LocusId.html#)`)` Sets the[LocusId](https://developer.android.com/reference/kotlin/android/content/LocusId.html#)associated with this shortcut.                                                                                                                                                      |
| open[ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | [setLongLabel](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#setLongLabel(kotlin.CharSequence))`(`longLabel:` `[CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)`)` Sets the text of a shortcut.                                                                                                                                                                                                                                               |
| open[ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | [setLongLived](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#setLongLived(kotlin.Boolean))`(`longLived:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Sets if a shortcut would be valid even if it has been unpublished/invisible by the app (as a dynamic or pinned shortcut).                                                                                                                                                                  |
| open[ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | [setPerson](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#setPerson(android.app.Person))`(`person:` `[Person](https://developer.android.com/reference/kotlin/android/app/Person.html#)`)` Add a person that is relevant to this shortcut.                                                                                                                                                                                                                                                  |
| open[ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | [setPersons](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#setPersons(kotlin.Array))`(`persons:` `[Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)<[Person](https://developer.android.com/reference/kotlin/android/app/Person.html#)!>`)` Sets multiple persons instead of a single person.                                                                                                                                                                  |
| open[ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | [setRank](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#setRank(kotlin.Int))`(`rank:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` "Rank" of a shortcut, which is a non-negative value that's used by the launcher app to sort shortcuts.                                                                                                                                                                                                                |
| open[ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | [setShortLabel](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#setShortLabel(kotlin.CharSequence))`(`shortLabel:` `[CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)`)` Sets the short title of a shortcut.                                                                                                                                                                                                                                     |
| open[ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | [setStartingTheme](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#setStartingTheme(kotlin.Int))`(`themeResId:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Sets a theme resource id for the splash screen.                                                                                                                                                                                                                                               |

## Public constructors

### Builder

Added in[API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Builder(
    context: Context!, 
    id: String!)
```

Constructor.

|                                                     Parameters                                                      ||
|-----------|----------------------------------------------------------------------------------------------------------|
| `context` | [Context](https://developer.android.com/reference/kotlin/android/content/Context.html#)!:Client context. |
| `id`      | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:ID of the shortcut.    |

## Public methods

### addCapabilityBinding

Added in[API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun addCapabilityBinding(
    capability: Capability, 
    capabilityParams: CapabilityParams?
): ShortcutInfo.Builder
```

Associates a shortcut with a capability, and a parameter of that capability. Used when the shortcut is an instance of a capability.

This method can be called multiple times to add multiple parameters to the same capability.

|                                                                                                                                              Parameters                                                                                                                                              ||
|--------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `capability`       | [Capability](https://developer.android.com/reference/kotlin/android/content/pm/Capability):[Capability](https://developer.android.com/reference/kotlin/android/content/pm/Capability)associated with the shortcut. This value cannot be`null`.                                   |
| `capabilityParams` | [CapabilityParams](https://developer.android.com/reference/kotlin/android/content/pm/CapabilityParams)?:Optional[CapabilityParams](https://developer.android.com/reference/kotlin/android/content/pm/CapabilityParams)associated with given capability. This value may be`null`. |

|                                                                    Return                                                                    ||
|-----------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | This value cannot be`null`. |

### build

Added in[API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun build(): ShortcutInfo
```

Creates a[ShortcutInfo](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo)instance.

|                                                           Return                                                            ||
|------------------------------------------------------------------------------------------------|-----------------------------|
| [ShortcutInfo](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo) | This value cannot be`null`. |

### setActivity

Added in[API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun setActivity(activity: ComponentName): ShortcutInfo.Builder
```

Sets the target activity. A shortcut will be shown along with this activity's icon on the launcher. When selecting a target activity, keep the following in mind:

- All dynamic shortcuts must have a target activity. When a shortcut with no target activity is published using[ShortcutManager.addDynamicShortcuts(List)](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutManager#addDynamicShortcuts(kotlin.collections.MutableList))or[ShortcutManager.setDynamicShortcuts(List)](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutManager#setDynamicShortcuts(kotlin.collections.MutableList)), the first main activity defined in the app's`AndroidManifest.xml`file is used.
- Only "main" activities---ones that define the[Intent.ACTION_MAIN](https://developer.android.com/reference/kotlin/android/content/Intent.html#ACTION_MAIN:kotlin.String)and[Intent.CATEGORY_LAUNCHER](https://developer.android.com/reference/kotlin/android/content/Intent.html#CATEGORY_LAUNCHER:kotlin.String)intent filters---can be target activities.
- By default, the first main activity defined in the app's manifest is the target activity.
- A target activity must belong to the publisher app.

<br />

|                                                                 Parameters                                                                  ||
|------------|---------------------------------------------------------------------------------------------------------------------------------|
| `activity` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#):This value cannot be`null`. |

|                                                                    Return                                                                    ||
|-----------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | This value cannot be`null`. |

**See Also**

- [android.content.pm.ShortcutInfo#getActivity()](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo#getActivity())  

### setCategories

Added in[API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun setCategories(categories: MutableSet<String!>!): ShortcutInfo.Builder
```

Sets categories for a shortcut.

- Launcher apps may use this information to categorize shortcuts
- Used by the system to associate a published Sharing Shortcut with supported mimeTypes. Required for published Sharing Shortcuts with a matching category declared in share targets, defined in the app's manifest linked shortcuts xml file.

<br />

|                                                                    Return                                                                    ||
|-----------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | This value cannot be`null`. |

**See Also**

- [#SHORTCUT_CATEGORY_CONVERSATION](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo#SHORTCUT_CATEGORY_CONVERSATION:kotlin.String)
- [android.content.pm.ShortcutInfo#getCategories()](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo#getCategories())  

### setDisabledMessage

Added in[API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun setDisabledMessage(disabledMessage: CharSequence): ShortcutInfo.Builder
```

Sets the message that should be shown when the user attempts to start a shortcut that is disabled.

|                                                                  Parameters                                                                  ||
|-------------------|---------------------------------------------------------------------------------------------------------------------------|
| `disabledMessage` | [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html):This value cannot be`null`. |

|                                                                    Return                                                                    ||
|-----------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | This value cannot be`null`. |

**See Also**

- [android.content.pm.ShortcutInfo#getDisabledMessage()](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo#getDisabledMessage())  

### setExcludedFromSurfaces

Added in[API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun setExcludedFromSurfaces(surfaces: Int): ShortcutInfo.Builder
```

Sets which surfaces a shortcut will be excluded from. This API is reserved for future extension. Currently, marking a shortcut to be excluded from[SURFACE_LAUNCHER](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo#SURFACE_LAUNCHER:kotlin.Int)will not publish the shortcut, thus the following operations will be a no-op:[android.content.pm.ShortcutManager#pushDynamicShortcut(android.content.pm.ShortcutInfo)](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutManager#pushDynamicShortcut(android.content.pm.ShortcutInfo)),[android.content.pm.ShortcutManager#addDynamicShortcuts(List)](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutManager#addDynamicShortcuts(kotlin.collections.MutableList)), and[android.content.pm.ShortcutManager#setDynamicShortcuts(List)](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutManager#setDynamicShortcuts(kotlin.collections.MutableList)).

|                                                                    Return                                                                    ||
|-----------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | This value cannot be`null`. |

### setExtras

Added in[API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun setExtras(extras: PersistableBundle): ShortcutInfo.Builder
```

Extras that the app can set for any purpose.

Apps can store arbitrary shortcut metadata in extras and retrieve the metadata later using[ShortcutInfo.getExtras()](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo#getExtras()).

|                                                                  Parameters                                                                  ||
|----------|------------------------------------------------------------------------------------------------------------------------------------|
| `extras` | [PersistableBundle](https://developer.android.com/reference/kotlin/android/os/PersistableBundle.html#):This value cannot be`null`. |

|                                                                    Return                                                                    ||
|-----------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | This value cannot be`null`. |

### setIcon

Added in[API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun setIcon(icon: Icon!): ShortcutInfo.Builder
```

Sets an icon of a shortcut.

Icons are not available on[ShortcutInfo](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo)instances returned by[ShortcutManager](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutManager)or[LauncherApps](https://developer.android.com/reference/kotlin/android/content/pm/LauncherApps). The default launcher app can use[LauncherApps.getShortcutIconDrawable(ShortcutInfo, int)](https://developer.android.com/reference/kotlin/android/content/pm/LauncherApps#getShortcutIconDrawable(android.content.pm.ShortcutInfo,%20kotlin.Int))or[LauncherApps.getShortcutBadgedIconDrawable(ShortcutInfo, int)](https://developer.android.com/reference/kotlin/android/content/pm/LauncherApps#getShortcutBadgedIconDrawable(android.content.pm.ShortcutInfo,%20kotlin.Int))to fetch shortcut icons.

Tints set with[Icon.setTint](https://developer.android.com/reference/kotlin/android/graphics/drawable/Icon.html#setTint(kotlin.Int))or[Icon.setTintList](https://developer.android.com/reference/kotlin/android/graphics/drawable/Icon.html#setTintList(android.content.res.ColorStateList))are not supported and will be ignored.

Only icons created with[Icon.createWithBitmap(Bitmap)](https://developer.android.com/reference/kotlin/android/graphics/drawable/Icon.html#createWithBitmap(android.graphics.Bitmap)),[Icon.createWithAdaptiveBitmap(Bitmap)](https://developer.android.com/reference/kotlin/android/graphics/drawable/Icon.html#createWithAdaptiveBitmap(android.graphics.Bitmap))and android.graphics.drawable.Icon#createWithResource are supported. Other types, such as URI-based icons, are not supported.

|                                                                    Return                                                                    ||
|-----------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | This value cannot be`null`. |

**See Also**

- [android.content.pm.LauncherApps#getShortcutIconDrawable(ShortcutInfo, int)](https://developer.android.com/reference/kotlin/android/content/pm/LauncherApps#getShortcutIconDrawable(android.content.pm.ShortcutInfo,%20kotlin.Int))
- [android.content.pm.LauncherApps#getShortcutBadgedIconDrawable(ShortcutInfo, int)](https://developer.android.com/reference/kotlin/android/content/pm/LauncherApps#getShortcutBadgedIconDrawable(android.content.pm.ShortcutInfo,%20kotlin.Int))  

### setIntent

Added in[API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun setIntent(intent: Intent): ShortcutInfo.Builder
```

Sets the intent of a shortcut. Alternatively,[setIntents(android.content.Intent[])](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#setIntents(kotlin.Array))can be used to launch an activity with other activities in the back stack.

This is a mandatory field when publishing a new shortcut with[ShortcutManager.addDynamicShortcuts(List)](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutManager#addDynamicShortcuts(kotlin.collections.MutableList))or[ShortcutManager.setDynamicShortcuts(List)](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutManager#setDynamicShortcuts(kotlin.collections.MutableList)).

A shortcut can launch any intent that the publisher app has permission to launch. For example, a shortcut can launch an unexported activity within the publisher app. A shortcut intent doesn't have to point at the target activity.

The given`intent`can contain extras, but these extras must contain values of primitive types in order for the system to persist these values.

|                                                         Parameters                                                          ||
|----------|-------------------------------------------------------------------------------------------------------------------|
| `intent` | [Intent](https://developer.android.com/reference/kotlin/android/content/Intent.html#):This value cannot be`null`. |

|                                                                    Return                                                                    ||
|-----------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | This value cannot be`null`. |

**See Also**

- [android.content.pm.ShortcutInfo#getIntent()](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo#getIntent())
- [#setIntents(Intent[])](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#setIntents(kotlin.Array))  

### setIntents

Added in[API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun setIntents(intents: Array<Intent!>): ShortcutInfo.Builder
```

Sets multiple intents instead of a single intent, in order to launch an activity with other activities in back stack. Use[TaskStackBuilder](https://developer.android.com/reference/kotlin/android/app/TaskStackBuilder.html#)to build intents. The last element in the list represents the only intent that doesn't place an activity on the back stack. See the[ShortcutManager](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutManager)javadoc for details.

|                                                                                                   Parameters                                                                                                    ||
|-----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `intents` | [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\<[Intent](https://developer.android.com/reference/kotlin/android/content/Intent.html#)!\>:This value cannot be`null`. |

|                                                                    Return                                                                    ||
|-----------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | This value cannot be`null`. |

**See Also**

- [android.content.pm.ShortcutInfo.Builder#setIntent(Intent)](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#setIntent(android.content.Intent))
- [android.content.pm.ShortcutInfo#getIntents()](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo#getIntents())
- [android.content.Context#startActivities(Intent[])](https://developer.android.com/reference/kotlin/android/content/Context.html#startActivities(kotlin.Array))
- [android.app.TaskStackBuilder](https://developer.android.com/reference/kotlin/android/app/TaskStackBuilder.html#)  

### setLocusId

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun setLocusId(locusId: LocusId): ShortcutInfo.Builder
```

Sets the[LocusId](https://developer.android.com/reference/kotlin/android/content/LocusId.html#)associated with this shortcut.

This method should be called when the[LocusId](https://developer.android.com/reference/kotlin/android/content/LocusId.html#)is used in other places (such as[Notification](https://developer.android.com/reference/kotlin/android/app/Notification.html#)and[ContentCaptureContext](https://developer.android.com/reference/kotlin/android/view/contentcapture/ContentCaptureContext.html#)) so the device's intelligence services can correlate them.

|                                                           Parameters                                                           ||
|-----------|---------------------------------------------------------------------------------------------------------------------|
| `locusId` | [LocusId](https://developer.android.com/reference/kotlin/android/content/LocusId.html#):This value cannot be`null`. |

|                                                                    Return                                                                    ||
|-----------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | This value cannot be`null`. |

### setLongLabel

Added in[API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun setLongLabel(longLabel: CharSequence): ShortcutInfo.Builder
```

Sets the text of a shortcut.

This field is intended to be more descriptive than the shortcut title. The launcher shows this instead of the short title when it has enough space.

The recommend maximum length is 25 characters.

|                                                               Parameters                                                               ||
|-------------|---------------------------------------------------------------------------------------------------------------------------|
| `longLabel` | [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html):This value cannot be`null`. |

|                                                                    Return                                                                    ||
|-----------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | This value cannot be`null`. |

**See Also**

- [android.content.pm.ShortcutInfo#getLongLabel()](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo#getLongLabel())  

### setLongLived

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun setLongLived(longLived: Boolean): ShortcutInfo.Builder
```

Sets if a shortcut would be valid even if it has been unpublished/invisible by the app (as a dynamic or pinned shortcut). If it is long lived, it can be cached by various system services even after it has been unpublished as a dynamic shortcut.

|                                                                    Return                                                                    ||
|-----------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | This value cannot be`null`. |

### setPerson

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun setPerson(person: Person): ShortcutInfo.Builder
```

Add a person that is relevant to this shortcut. Alternatively,[setPersons(android.app.Person[])](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#setPersons(kotlin.Array))can be used to add multiple persons to a shortcut.

This is an optional field, but the addition of person may cause this shortcut to appear more prominently in the user interface (e.g. ShareSheet).

A person should usually contain a uri in order to benefit from the ranking boost. However, even if no uri is provided, it's beneficial to provide people in the shortcut, such that listeners and voice only devices can announce and handle them properly.

|                                                       Parameters                                                        ||
|----------|---------------------------------------------------------------------------------------------------------------|
| `person` | [Person](https://developer.android.com/reference/kotlin/android/app/Person.html#):This value cannot be`null`. |

|                                                                    Return                                                                    ||
|-----------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | This value cannot be`null`. |

**See Also**

- [android.app.Person](https://developer.android.com/reference/kotlin/android/app/Person.html#)
- [#setPersons(Person[])](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#setPersons(kotlin.Array))  

### setPersons

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun setPersons(persons: Array<Person!>): ShortcutInfo.Builder
```

Sets multiple persons instead of a single person.

|                                                                                                 Parameters                                                                                                  ||
|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `persons` | [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\<[Person](https://developer.android.com/reference/kotlin/android/app/Person.html#)!\>:This value cannot be`null`. |

|                                                                    Return                                                                    ||
|-----------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | This value cannot be`null`. |

**See Also**

- [android.app.Person](https://developer.android.com/reference/kotlin/android/app/Person.html#)
- [#setPerson(Person)](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#setPerson(android.app.Person))  

### setRank

Added in[API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun setRank(rank: Int): ShortcutInfo.Builder
```

"Rank" of a shortcut, which is a non-negative value that's used by the launcher app to sort shortcuts. See[ShortcutInfo.getRank()](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo#getRank())for details.

|                                                                    Return                                                                    ||
|-----------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | This value cannot be`null`. |

### setShortLabel

Added in[API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun setShortLabel(shortLabel: CharSequence): ShortcutInfo.Builder
```

Sets the short title of a shortcut.

This is a mandatory field when publishing a new shortcut with[ShortcutManager.addDynamicShortcuts(List)](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutManager#addDynamicShortcuts(kotlin.collections.MutableList))or[ShortcutManager.setDynamicShortcuts(List)](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutManager#setDynamicShortcuts(kotlin.collections.MutableList)).

This field is intended to be a concise description of a shortcut.

The recommended maximum length is 10 characters.

|                                                               Parameters                                                                ||
|--------------|---------------------------------------------------------------------------------------------------------------------------|
| `shortLabel` | [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html):This value cannot be`null`. |

|                                                                    Return                                                                    ||
|-----------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | This value cannot be`null`. |

**See Also**

- [android.content.pm.ShortcutInfo#getShortLabel()](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo#getShortLabel())  

### setStartingTheme

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun setStartingTheme(themeResId: Int): ShortcutInfo.Builder
```

Sets a theme resource id for the splash screen.

|                                                                    Return                                                                    ||
|-----------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ShortcutInfo.Builder](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.Builder#) | This value cannot be`null`. |