# ShortcutInfoCompat.Builder

# ShortcutInfoCompat.Builder

Artifact:[androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core)  
[View Source](https://cs.android.com/search?q=file:androidx/core/content/pm/ShortcutInfoCompat.java+class:androidx.core.content.pm.ShortcutInfoCompat.Builder)  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

*** ** * ** ***

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

<br />

```
class ShortcutInfoCompat.Builder
```

<br />

*** ** * ** ***

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

## Summary

|                                                                                                                                                                ### Public constructors                                                                                                                                                                 |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Builder](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder#Builder(android.content.Context,java.lang.String))`(context: `[Context](https://developer.android.com/reference/android/content/Context.html)`, id: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`)` |

|                                                       ### Public functions                                                       |
|----------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ShortcutInfoCompat.Builder](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder) | [addCapabilityBinding](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder#addCapabilityBinding(java.lang.String))`(capability: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`)` Associates a shortcut with a capability without any parameters.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| [ShortcutInfoCompat.Builder](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder) | [addCapabilityBinding](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder#addCapabilityBinding(java.lang.String,java.lang.String,java.util.List<java.lang.String>))`(` ` capability: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`,` ` parameter: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`,` ` parameterValues: (`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!>` `)` Associates a shortcut with a capability, and a parameter of that capability. |
| [ShortcutInfoCompat](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat)                 | [build](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder#build())`()` Creates a[ShortcutInfoCompat](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat)instance.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| [ShortcutInfoCompat.Builder](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder) | [setActivity](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder#setActivity(android.content.ComponentName))`(activity: `[ComponentName](https://developer.android.com/reference/android/content/ComponentName.html)`)` Sets the target activity.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| [ShortcutInfoCompat.Builder](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder) | [setAlwaysBadged](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder#setAlwaysBadged())`()` Badges the icon before passing it over to the Launcher.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| [ShortcutInfoCompat.Builder](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder) | [setCategories](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder#setCategories(java.util.Set<java.lang.String>))`(categories: (`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html)`)`[Set](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html)`<`[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!>)` Sets categories for a shortcut.                                                                                                                                                                                                                                                                                                                     |
| [ShortcutInfoCompat.Builder](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder) | [setDisabledMessage](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder#setDisabledMessage(java.lang.CharSequence))`(disabledMessage: `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`)` Sets the message that should be shown when the user attempts to start a shortcut that is disabled.                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| [ShortcutInfoCompat.Builder](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder) | [setExcludedFromSurfaces](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder#setExcludedFromSurfaces(int))`(surfaces: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Sets which surfaces a shortcut will be excluded from.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| [ShortcutInfoCompat.Builder](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder) | [setExtras](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder#setExtras(android.os.PersistableBundle))`(extras: `[PersistableBundle](https://developer.android.com/reference/android/os/PersistableBundle.html)`)` Extras that the app can set for any purpose.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| [ShortcutInfoCompat.Builder](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder) | [setIcon](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder#setIcon(androidx.core.graphics.drawable.IconCompat))`(icon: `[IconCompat](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat)`!)` Sets an icon of a shortcut.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| [ShortcutInfoCompat.Builder](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder) | [setIntent](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder#setIntent(android.content.Intent))`(intent: `[Intent](https://developer.android.com/reference/android/content/Intent.html)`)` Sets the intent of a shortcut.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| [ShortcutInfoCompat.Builder](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder) | [setIntents](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder#setIntents(android.content.Intent[]))`(intents: `[Array](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html)`<`[Intent](https://developer.android.com/reference/android/content/Intent.html)`!>)` Sets multiple intents instead of a single intent, in order to launch an activity with other activities in back stack.                                                                                                                                                                                                                                                                                                                                                                  |
| [ShortcutInfoCompat.Builder](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder) | [setIsConversation](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder#setIsConversation())`()` Sets the corresponding fields indicating this shortcut is aimed for conversation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| [ShortcutInfoCompat.Builder](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder) | [setLocusId](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder#setLocusId(androidx.core.content.LocusIdCompat))`(locusId: `[LocusIdCompat](https://developer.android.com/reference/kotlin/androidx/core/content/LocusIdCompat)`?)` Sets the[LocusIdCompat](https://developer.android.com/reference/kotlin/androidx/core/content/LocusIdCompat)associated with this shortcut.                                                                                                                                                                                                                                                                                                                                                                                                |
| [ShortcutInfoCompat.Builder](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder) | [setLongLabel](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder#setLongLabel(java.lang.CharSequence))`(longLabel: `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`)` Sets the text of a shortcut.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| [ShortcutInfoCompat.Builder](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder) | ~~[setLongLived](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder#setLongLived())~~`()` **This function is deprecated.** Use {@ink #setLongLived(boolean)) instead. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| [ShortcutInfoCompat.Builder](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder) | [setLongLived](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder#setLongLived(boolean))`(longLived: `[Boolean](https://kotlinlang.org/api/core/kotlin-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).                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| [ShortcutInfoCompat.Builder](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder) | [setPerson](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder#setPerson(androidx.core.app.Person))`(person: `[Person](https://developer.android.com/reference/kotlin/androidx/core/app/Person)`)` Associate a person to a shortcut.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| [ShortcutInfoCompat.Builder](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder) | [setPersons](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder#setPersons(androidx.core.app.Person[]))`(persons: `[Array](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html)`<`[Person](https://developer.android.com/reference/kotlin/androidx/core/app/Person)`!>)` Sets multiple persons instead of a single person.                                                                                                                                                                                                                                                                                                                                                                                                                                |
| [ShortcutInfoCompat.Builder](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder) | [setRank](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder#setRank(int))`(rank: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Sets rank of a shortcut, which is a non-negative value that's used by the system to sort shortcuts.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| [ShortcutInfoCompat.Builder](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder) | [setShortLabel](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder#setShortLabel(java.lang.CharSequence))`(shortLabel: `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`)` Sets the short title of a shortcut.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| [ShortcutInfoCompat.Builder](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder) | [setSliceUri](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder#setSliceUri(android.net.Uri))`(sliceUri: `[Uri](https://developer.android.com/reference/android/net/Uri.html)`)` Sets the slice uri for a shortcut.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |

## Public constructors

### Builder

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

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

## Public functions

### addCapabilityBinding

Added in[1.6.0](https://developer.android.com/jetpack/androidx/releases/core#1.6.0)  

```
fun addCapabilityBinding(capability: String): ShortcutInfoCompat.Builder
```

Associates a shortcut with a capability without any parameters. Used when the shortcut is an instance of a capability.

This method can be called multiple times to associate multiple capabilities with this shortcut.  

|                                           Parameters                                            |
|-------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------|
| `capability: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) | capability associated with the shortcut. e.g. actions.intent .START_EXERCISE. |

### addCapabilityBinding

Added in[1.6.0](https://developer.android.com/jetpack/androidx/releases/core#1.6.0)  

```
fun addCapabilityBinding(
    capability: String,
    parameter: String,
    parameterValues: (Mutable)List<String!>
): ShortcutInfoCompat.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 associate multiple capabilities with this shortcut, or add multiple parameters to the same capability.  

|                                                                                                                                                  Parameters                                                                                                                                                  |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `capability: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)                                                                                                                                                                                                              | capability associated with the shortcut. e.g. actions.intent .START_EXERCISE.                                                                                                                            |
| `parameter: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)                                                                                                                                                                                                               | the parameter associated with the capability. e.g. exercise.name.                                                                                                                                        |
| `parameterValues: (`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!>` | a list of values for that parameters. The first value will be the primary name, while the rest will be alternative names. If the values are empty, then the parameter will not be saved in the shortcut. |

### build

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
fun build(): ShortcutInfoCompat
```

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

### setActivity

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
fun setActivity(activity: ComponentName): ShortcutInfoCompat.Builder
```

Sets the target activity. A shortcut will be shown along with this activity's icon on the launcher.  

|                                                                    See also                                                                    |
|------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [getActivity](https://developer.android.com/reference/android/content/pm/ShortcutInfo.html#getActivity())                                      |   |
| [setActivity](https://developer.android.com/reference/android/content/pm/ShortcutInfo.Builder.html#setActivity(android.content.ComponentName)) |   |

### setAlwaysBadged

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
fun setAlwaysBadged(): ShortcutInfoCompat.Builder
```

Badges the icon before passing it over to the Launcher.

Launcher automatically badges[ShortcutInfo](https://developer.android.com/reference/android/content/pm/ShortcutInfo.html), so only the legacy shortcut icon,[Intent.ShortcutIconResource](https://developer.android.com/reference/android/content/Intent.ShortcutIconResource.html)is badged. This field is ignored when using[ShortcutInfo](https://developer.android.com/reference/android/content/pm/ShortcutInfo.html)on API 25 and above.

If the shortcut is associated with an activity, the activity icon is used as the badge, otherwise application icon is used.  

|                                                                           See also                                                                           |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [setActivity](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder#setActivity(android.content.ComponentName)) |   |

### setCategories

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
fun setCategories(categories: (Mutable)Set<String!>): ShortcutInfoCompat.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.

|                                                   See also                                                    |
|---------------------------------------------------------------------------------------------------------------|---|
| [getCategories](https://developer.android.com/reference/android/content/pm/ShortcutInfo.html#getCategories()) |   |

### setDisabledMessage

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
fun setDisabledMessage(disabledMessage: CharSequence): ShortcutInfoCompat.Builder
```

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

|                                                        See also                                                         |
|-------------------------------------------------------------------------------------------------------------------------|---|
| [getDisabledMessage](https://developer.android.com/reference/android/content/pm/ShortcutInfo.html#getDisabledMessage()) |   |

### setExcludedFromSurfaces

Added in[1.8.0](https://developer.android.com/jetpack/androidx/releases/core#1.8.0)  

```
fun setExcludedFromSurfaces(surfaces: Int): ShortcutInfoCompat.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/androidx/core/content/pm/ShortcutInfoCompat#SURFACE_LAUNCHER())will not publish the shortcut, thus the following operations will be a no-op:[pushDynamicShortcut](https://developer.android.com/reference/android/content/pm/ShortcutManager.html#pushDynamicShortcut(android.content.pm.ShortcutInfo)),[addDynamicShortcuts](https://developer.android.com/reference/android/content/pm/ShortcutManager.html#addDynamicShortcuts(java.util.List&lt;android.content.pm.ShortcutInfo&gt;)), and[setDynamicShortcuts](https://developer.android.com/reference/android/content/pm/ShortcutManager.html#setDynamicShortcuts(java.util.List&lt;android.content.pm.ShortcutInfo&gt;)).

On API \<= 31, shortcuts that are excluded from[SURFACE_LAUNCHER](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat#SURFACE_LAUNCHER())are not actually sent to[ShortcutManager](https://developer.android.com/reference/android/content/pm/ShortcutManager.html). These shortcuts might still be made available to other surfaces via alternative means.  

### setExtras

Added in[1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)  

```
fun setExtras(extras: PersistableBundle): ShortcutInfoCompat.Builder
```

Extras that the app can set for any purpose.

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

|                                               See also                                                |
|-------------------------------------------------------------------------------------------------------|---|
| [getExtras](https://developer.android.com/reference/android/content/pm/ShortcutInfo.html#getExtras()) |   |

### setIcon

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
fun setIcon(icon: IconCompat!): ShortcutInfoCompat.Builder
```

Sets an icon of a shortcut.  

### setIntent

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
fun setIntent(intent: Intent): ShortcutInfoCompat.Builder
```

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

This is a mandatory field when publishing a new shortcut.

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

### setIntents

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

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

Sets multiple intents instead of a single intent, in order to launch an activity with other activities in back stack. Use[android.app.TaskStackBuilder](https://developer.android.com/reference/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.  

### setIsConversation

Added in[1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)  

```
fun setIsConversation(): ShortcutInfoCompat.Builder
```

Sets the corresponding fields indicating this shortcut is aimed for conversation.

If the shortcut is not associated with a[LocusIdCompat](https://developer.android.com/reference/kotlin/androidx/core/content/LocusIdCompat), a[LocusIdCompat](https://developer.android.com/reference/kotlin/androidx/core/content/LocusIdCompat)based on[getId](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat#getId())will be added upon[build](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder#build())

Additionally, the shortcut will be long-lived.  

|                                                                 See also                                                                 |
|------------------------------------------------------------------------------------------------------------------------------------------|---|
| [setLongLived](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder#setLongLived(boolean)) |   |

### setLocusId

Added in[1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)  

```
fun setLocusId(locusId: LocusIdCompat?): ShortcutInfoCompat.Builder
```

Sets the[LocusIdCompat](https://developer.android.com/reference/kotlin/androidx/core/content/LocusIdCompat)associated with this shortcut.

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

### setLongLabel

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
fun setLongLabel(longLabel: CharSequence): ShortcutInfoCompat.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.  

### setLongLived

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  
Deprecated in[1.2.0](https://developer.android.com/jetpack/androidx/releases/core#1.2.0)  

```
fun [setLongLived](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder#setLongLived())(): ShortcutInfoCompat.Builder
```
| **This function is deprecated.**   
|
Use {@ink #setLongLived(boolean)) instead.  

### setLongLived

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/core#1.2.0)  

```
fun setLongLived(longLived: Boolean): ShortcutInfoCompat.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.  

### setPerson

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
fun setPerson(person: Person): ShortcutInfoCompat.Builder
```

Associate a person to a shortcut. Alternatively,[setPersons](https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat.Builder#setPersons(androidx.core.app.Person[]))can be used to add multiple persons to a shortcut.

This is an optional field when publishing a new shortcut.  

|                                     See also                                      |
|-----------------------------------------------------------------------------------|---|
| [Person](https://developer.android.com/reference/kotlin/androidx/core/app/Person) |   |

### setPersons

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

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

Sets multiple persons instead of a single person.  

### setRank

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/core#1.2.0)  

```
fun setRank(rank: Int): ShortcutInfoCompat.Builder
```

Sets rank of a shortcut, which is a non-negative value that's used by the system to sort shortcuts. Lower value means higher importance.  

|                                             See also                                              |
|---------------------------------------------------------------------------------------------------|--------------|
| [getRank](https://developer.android.com/reference/android/content/pm/ShortcutInfo.html#getRank()) | for details. |

### setShortLabel

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
fun setShortLabel(shortLabel: CharSequence): ShortcutInfoCompat.Builder
```

Sets the short title of a shortcut.

This is a mandatory field when publishing a new shortcut.

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

The recommended maximum length is 10 characters.  

### setSliceUri

Added in[1.6.0](https://developer.android.com/jetpack/androidx/releases/core#1.6.0)  

```
fun setSliceUri(sliceUri: Uri): ShortcutInfoCompat.Builder
```

Sets the slice uri for a shortcut. The uri will be used if this shortcuts represents a slice, instead of an intent.