Activity.SetLocusContext(LocusId, Bundle) Method

Definition

Sets the android.content.LocusId for this activity.

[Android.Runtime.Register("setLocusContext", "(Landroid/content/LocusId;Landroid/os/Bundle;)V", "GetSetLocusContext_Landroid_content_LocusId_Landroid_os_Bundle_Handler", ApiSince=30)]
public virtual void SetLocusContext (Android.Content.LocusId? locusId, Android.OS.Bundle? bundle);
[<Android.Runtime.Register("setLocusContext", "(Landroid/content/LocusId;Landroid/os/Bundle;)V", "GetSetLocusContext_Landroid_content_LocusId_Landroid_os_Bundle_Handler", ApiSince=30)>]
abstract member SetLocusContext : Android.Content.LocusId * Android.OS.Bundle -> unit
override this.SetLocusContext : Android.Content.LocusId * Android.OS.Bundle -> unit

Parameters

locusId
LocusId

a unique, stable id that identifies this Activity instance. LocusId is an opaque ID that links this Activity's state to different Android concepts: android.content.pm.ShortcutInfo.Builder#setLocusId(android.content.LocusId) setLocusId. LocusID is null by default or if you explicitly reset it.

bundle
Bundle

extras set or updated as part of this locus context. This may help provide additional metadata such as URLs, conversation participants specific to this Activity's context. Bundle can be null if additional metadata is not needed. Bundle should always be null for null locusId.

Attributes

Remarks

Sets the android.content.LocusId for this activity. The locus id helps identify different instances of the same Activity class.

For example, a locus id based on a specific conversation could be set on a conversation app's chat Activity. The system can then use this locus id along with app's contents to provide ranking signals in various UI surfaces including sharing, notifications, shortcuts and so on.

It is recommended to set the same locus id in the shortcut's locus id using android.content.pm.ShortcutInfo.Builder#setLocusId(android.content.LocusId) setLocusId so that the system can learn appropriate ranking signals linking the activity's locus id with the matching shortcut.

Java documentation for android.app.Activity.setLocusContext(android.content.LocusId, android.os.Bundle).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to