Added in API level 26

AssociationRequest

class AssociationRequest : Parcelable
kotlin.Any
   ↳ android.companion.AssociationRequest

A request for the user to select a companion device to associate with. You can optionally set filters for which devices to show to the user to select from. The exact type and fields of the filter you can set depend on the medium type. See Builder's static factory methods for specific protocols that are supported. You can also set single device to request a popup with single device to be shown instead of a list to choose from

Summary

Nested classes

A builder for AssociationRequest

Constants
static String

Device profile: a virtual display capable of rendering Android applications, and sending back input events.

static String

Device profile: Android Automotive Projection Only applications that have been granted android.Manifest.permission#REQUEST_COMPANION_PROFILE_AUTOMOTIVE_PROJECTION are allowed to request to be associated with such devices.

static String

Device profile: Allows the companion app to access notification, recent photos and media for computer cross-device features.

static String

Device profile: glasses.

static String

Device profile: a virtual device capable of rendering content from an Android host to a nearby device.

static String

Device profile: watch.

Inherited constants
Public methods
Int

Boolean
equals(other: Any?)

Indicates whether some other object is "equal to" this one.

String?

CharSequence?

The Display name of the device to be shown in the CDM confirmation UI.

Int

Boolean

Indicates whether the application requires the CompanionDeviceManager service to collect an explicit confirmation from the user before creating an association, even if such confirmation is not required from the service's perspective.

Boolean

Whether the association is to be managed by the companion application.

Boolean

Whether only a single device should match the provided filter.

String

Unit
writeToParcel(dest: Parcel, flags: Int)

Flatten this object in to a Parcel.

Properties
static Parcelable.Creator<AssociationRequest!>

Constants

DEVICE_PROFILE_APP_STREAMING

Added in API level 33
static val DEVICE_PROFILE_APP_STREAMING: String

Device profile: a virtual display capable of rendering Android applications, and sending back input events. Only applications that have been granted android.Manifest.permission#REQUEST_COMPANION_PROFILE_APP_STREAMING are allowed to request to be associated with such devices.
Requires android.Manifest.permission#REQUEST_COMPANION_PROFILE_APP_STREAMING

Value: "android.app.role.COMPANION_DEVICE_APP_STREAMING"

DEVICE_PROFILE_AUTOMOTIVE_PROJECTION

Added in API level 33
static val DEVICE_PROFILE_AUTOMOTIVE_PROJECTION: String

Device profile: Android Automotive Projection Only applications that have been granted android.Manifest.permission#REQUEST_COMPANION_PROFILE_AUTOMOTIVE_PROJECTION are allowed to request to be associated with such devices.
Requires android.Manifest.permission#REQUEST_COMPANION_PROFILE_AUTOMOTIVE_PROJECTION

Value: "android.app.role.SYSTEM_AUTOMOTIVE_PROJECTION"

DEVICE_PROFILE_COMPUTER

Added in API level 33
static val DEVICE_PROFILE_COMPUTER: String

Device profile: Allows the companion app to access notification, recent photos and media for computer cross-device features. Only applications that have been granted android.Manifest.permission#REQUEST_COMPANION_PROFILE_COMPUTER are allowed to request to be associated with such devices.
Requires android.Manifest.permission#REQUEST_COMPANION_PROFILE_COMPUTER

Value: "android.app.role.COMPANION_DEVICE_COMPUTER"

DEVICE_PROFILE_GLASSES

Added in API level 34
static val DEVICE_PROFILE_GLASSES: String

Device profile: glasses. If specified, the current request may have a modified UI to highlight that the device being set up is a glasses device, and some extra permissions may be granted to the app as a result. Using it requires declaring uses-permission android.Manifest.permission#REQUEST_COMPANION_PROFILE_GLASSES in the manifest.
Requires android.Manifest.permission#REQUEST_COMPANION_PROFILE_GLASSES

Value: "android.app.role.COMPANION_DEVICE_GLASSES"

DEVICE_PROFILE_NEARBY_DEVICE_STREAMING

Added in API level 34
static val DEVICE_PROFILE_NEARBY_DEVICE_STREAMING: String

Device profile: a virtual device capable of rendering content from an Android host to a nearby device. Only applications that have been granted android.Manifest.permission#REQUEST_COMPANION_PROFILE_NEARBY_DEVICE_STREAMING are allowed to request to be associated with such devices.
Requires android.Manifest.permission#REQUEST_COMPANION_PROFILE_NEARBY_DEVICE_STREAMING

Value: "android.app.role.COMPANION_DEVICE_NEARBY_DEVICE_STREAMING"

DEVICE_PROFILE_WATCH

Added in API level 31
static val DEVICE_PROFILE_WATCH: String

Device profile: watch. If specified, the current request may have a modified UI to highlight that the device being set up is a specific kind of device, and some extra permissions may be granted to the app as a result. Using it requires declaring uses-permission android.Manifest.permission#REQUEST_COMPANION_PROFILE_WATCH in the manifest. Learn more about device profiles.

Value: "android.app.role.COMPANION_DEVICE_WATCH"

Public methods

describeContents

Added in API level 26
fun describeContents(): Int
Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

equals

Added in API level 26
fun equals(other: Any?): Boolean

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj the reference object with which to compare.
o This value may be null.
Return
Boolean true if this object is the same as the obj argument; false otherwise.

getDisplayName

Added in API level 33
fun getDisplayName(): CharSequence?

The Display name of the device to be shown in the CDM confirmation UI. Must be non-null for "self-managed" association.

hashCode

Added in API level 26
fun hashCode(): Int
Return
Int a hash code value for this object.

isForceConfirmation

Added in API level 33
fun isForceConfirmation(): Boolean

Indicates whether the application requires the CompanionDeviceManager service to collect an explicit confirmation from the user before creating an association, even if such confirmation is not required from the service's perspective.

isSelfManaged

Added in API level 33
fun isSelfManaged(): Boolean

Whether the association is to be managed by the companion application.

isSingleDevice

Added in API level 33
fun isSingleDevice(): Boolean

Whether only a single device should match the provided filter. When scanning for a single device with a specific BluetoothDeviceFilter mac address, bonded devices are also searched among. This allows to obtain the necessary app privileges even if the device is already paired.

toString

Added in API level 26
fun toString(): String
Return
String a string representation of the object.

writeToParcel

Added in API level 26
fun writeToParcel(
    dest: Parcel,
    flags: Int
): Unit

Flatten this object in to a Parcel.

Parameters
dest Parcel: This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Properties

CREATOR

Added in API level 26
static val CREATOR: Parcelable.Creator<AssociationRequest!>