LocusIdCompat

class LocusIdCompat
kotlin.Any
   ↳ androidx.core.content.LocusIdCompat

An identifier for an unique state (locus) in the application. Should be stable across reboots and backup / restore.

Locus is a new concept introduced on Android Q and it lets the Android system correlate state between different subsystems such as content capture, shortcuts, and notifications.

For example, if your app provides an activiy representing a chat between 2 users (say A and B, this chat state could be represented by:

<code>
  LocusIdCompat chatId = new LocusIdCompat("Chat_A_B");
  </code>

And then you should use that chatId by:

Summary

Public constructors
<init>(@NonNull id: String)

Construct a new LocusIdCompat with the specified id.

Public methods
Boolean
equals(@Nullable other: Any?)

String

Gets the canonical id associated with the locus.

Int

LocusId

static LocusIdCompat
toLocusIdCompat(@NonNull locusId: LocusId)

Returns an instance of LocusIdCompat from given LocusId.

String

Public constructors

<init>

LocusIdCompat(@NonNull id: String)

Construct a new LocusIdCompat with the specified id.

Exceptions
IllegalArgumentException if id is empty or null.

Public methods

equals

fun equals(@Nullable other: Any?): Boolean

getId

@NonNull fun getId(): String

Gets the canonical id associated with the locus.

hashCode

fun hashCode(): Int

toLocusId

@NonNull @RequiresApi(29) fun toLocusId(): LocusId
Return
LocusId LocusId object from this compat object.

toLocusIdCompat

@NonNull @RequiresApi(29) static fun toLocusIdCompat(@NonNull locusId: LocusId): LocusIdCompat

Returns an instance of LocusIdCompat from given LocusId.

toString

@NonNull fun toString(): String