Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions) Summary: [Ctors](https://developer.android.com/reference/android/companion/CompanionDeviceManager.TrustPairingCallback#pubctors) \| [Methods](https://developer.android.com/reference/android/companion/CompanionDeviceManager.TrustPairingCallback#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/companion/CompanionDeviceManager.TrustPairingCallback#inhmethods)

# CompanionDeviceManager.TrustPairingCallback

*** ** * ** ***


`
public
static

abstract
class
CompanionDeviceManager.TrustPairingCallback
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.companion.CompanionDeviceManager.TrustPairingCallback |

<br />

*** ** * ** ***

Callback for applications to receive updates about and the outcome of
`https://developer.android.com/reference/android/companion/CompanionDeviceManager#requestDeviceTrustPairing(int,%20android.companion.OutOfBandPairingRequest,%20int[],%20java.util.concurrent.Executor,%20android.companion.CompanionDeviceManager.TrustPairingCallback)`

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/companion/CompanionDeviceManager.TrustPairingCallback#TrustPairingCallback()() ` |

| ### Public methods ||
|---|---|
| ` abstract void` | ` https://developer.android.com/reference/android/companion/CompanionDeviceManager.TrustPairingCallback#onDeviceTrusted(android.companion.AssociationInfo)(https://developer.android.com/reference/android/companion/AssociationInfo associationInfo) ` Invoked when the device is trusted. |
| ` abstract void` | ` https://developer.android.com/reference/android/companion/CompanionDeviceManager.TrustPairingCallback#onFailure(int)(int errorCode) ` Invoked if the trust pairing could not be created or explicitly failed. |
| ` abstract void` | ` https://developer.android.com/reference/android/companion/CompanionDeviceManager.TrustPairingCallback#onTrustPairingCanceledFromRemote(android.companion.AssociationInfo,%20android.content.IntentSender)(https://developer.android.com/reference/android/companion/AssociationInfo associationInfo, https://developer.android.com/reference/android/content/IntentSender cancelIntentSender) ` Invoked when the trust pairing is canceled by the remote device. |
| ` abstract void` | ` https://developer.android.com/reference/android/companion/CompanionDeviceManager.TrustPairingCallback#onTrustPairingPending(android.content.IntentSender)(https://developer.android.com/reference/android/content/IntentSender intentSender) ` Invoked when a trust pairing confirmation is required. |

### Inherited methods

From class `

https://developer.android.com/reference/java/lang/Object

` `


https://developer.android.com/reference/java/lang/Object` `
https://developer.android.com/reference/java/lang/Object#clone()()
`

Creates and returns a copy of this object.


`


boolean` `
https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj)
`

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


`


void` `
https://developer.android.com/reference/java/lang/Object#finalize()()
`

Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.


`


final

https://developer.android.com/reference/java/lang/Class<?>` `
https://developer.android.com/reference/java/lang/Object#getClass()()
`

Returns the runtime class of this `Object`.


`


int` `
https://developer.android.com/reference/java/lang/Object#hashCode()()
`

Returns a hash code value for the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notify()()
`

Wakes up a single thread that is waiting on this object's
monitor.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notifyAll()()
`

Wakes up all threads that are waiting on this object's monitor.


`


https://developer.android.com/reference/java/lang/String` `
https://developer.android.com/reference/java/lang/Object#toString()()
`

Returns a string representation of the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait()()
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*.


## Public constructors

### TrustPairingCallback

```
public TrustPairingCallback ()
```

<br />

<br />

## Public methods

### onDeviceTrusted

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public abstract void onDeviceTrusted (AssociationInfo associationInfo)
```

Invoked when the device is trusted.

<br />

| Parameters ||
|---|---|
| `associationInfo` | `AssociationInfo`: contains details of the newly-trusted association. This value cannot be `null`. <br /> |

### onFailure

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public abstract void onFailure (int errorCode)
```

Invoked if the trust pairing could not be created or explicitly failed.

<br />

| Parameters ||
|---|---|
| `errorCode` | `int`: One of: - `https://developer.android.com/reference/android/companion/CompanionDeviceManager#ERROR_TRUST_UNKNOWN` - `https://developer.android.com/reference/android/companion/CompanionDeviceManager#ERROR_TRUST_PAIRING_TRANSPORT_NOT_ATTACHED` - `https://developer.android.com/reference/android/companion/CompanionDeviceManager#ERROR_TRUST_PAIRING_CANCELED` - `https://developer.android.com/reference/android/companion/CompanionDeviceManager#ERROR_TRUST_PAIRING_FAILED_TO_CREATE_PAIRING_DIALOG` - `https://developer.android.com/reference/android/companion/CompanionDeviceManager#ERROR_TRUST_PAIRING_PIN_CODE_NOT_MATCHING` - `https://developer.android.com/reference/android/companion/CompanionDeviceManager#ERROR_TRUST_PAIRING_ASSOCIATION_DOES_NOT_EXIST` - `https://developer.android.com/reference/android/companion/CompanionDeviceManager#ERROR_TRUST_OUT_OF_BAND_PAIRING_FAILED` . Value is one of the following: - `https://developer.android.com/reference/android/companion/CompanionDeviceManager#ERROR_TRUST_UNKNOWN` - `https://developer.android.com/reference/android/companion/CompanionDeviceManager#ERROR_TRUST_PAIRING_TRANSPORT_NOT_ATTACHED` - `https://developer.android.com/reference/android/companion/CompanionDeviceManager#ERROR_TRUST_PAIRING_CANCELED` - `https://developer.android.com/reference/android/companion/CompanionDeviceManager#ERROR_TRUST_PAIRING_FAILED_TO_CREATE_PAIRING_DIALOG` - `https://developer.android.com/reference/android/companion/CompanionDeviceManager#ERROR_TRUST_PAIRING_PIN_CODE_NOT_MATCHING` - `https://developer.android.com/reference/android/companion/CompanionDeviceManager#ERROR_TRUST_PAIRING_ASSOCIATION_DOES_NOT_EXIST` - `https://developer.android.com/reference/android/companion/CompanionDeviceManager#ERROR_TRUST_RESUMPTION_FAILED` - `https://developer.android.com/reference/android/companion/CompanionDeviceManager#ERROR_TRUST_OUT_OF_BAND_PAIRING_FAILED` |

### onTrustPairingCanceledFromRemote

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public abstract void onTrustPairingCanceledFromRemote (AssociationInfo associationInfo, 
                IntentSender cancelIntentSender)
```

Invoked when the trust pairing is canceled by the remote device. The application is
expected to launch the provided `cancelIntentSender` to cancel the trust
pairing.

<br />

| Parameters ||
|---|---|
| `associationInfo` | `AssociationInfo`: contains details of the association. This value cannot be `null`. <br /> |
| `cancelIntentSender` | `IntentSender`: an `https://developer.android.com/reference/android/content/IntentSender` which applications should launch in order to cancel the trust pairing dialog. This value cannot be `null`. <br /> |

### onTrustPairingPending

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public abstract void onTrustPairingPending (IntentSender intentSender)
```

Invoked when a trust pairing confirmation is required. This can happen when the
pairing was initiated by the local device.
The application is expected to launch the provided `intentSender` to
display the user confirmation dialog.

<br />

| Parameters ||
|---|---|
| `intentSender` | `IntentSender`: an `https://developer.android.com/reference/android/content/IntentSender` which applications should use to launch the UI for the user to confirm the trust pairing. This value cannot be `null`. <br /> |