CompanionDeviceManager Class

Definition

System level service for managing companion devices

        See <a href="https://developer.android.com/guide/topics/connectivity/companion-device-pairing">this guide</a>
        for a usage example.
[Android.Runtime.Register("android/companion/CompanionDeviceManager", ApiSince=26, DoNotGenerateAcw=true)]
public sealed class CompanionDeviceManager : Java.Lang.Object
[<Android.Runtime.Register("android/companion/CompanionDeviceManager", ApiSince=26, DoNotGenerateAcw=true)>]
type CompanionDeviceManager = class
    inherit Object
Inheritance
CompanionDeviceManager
Attributes

Remarks

System level service for managing companion devices

See this guide for a usage example.

To obtain an instance call Context#getSystemService(Context#COMPANION_DEVICE_SERVICE) Then, call #associate(AssociationRequest, Callback, Handler) to initiate the flow of associating current package with a device selected by user.

Java documentation for android.companion.CompanionDeviceManager.

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.

Fields

ExtraAssociation

Extra field name for the AssociationInfo object, included into android.content.Intent which application receive in Activity#onActivityResult(int, int, Intent) after the application's AssociationRequest was successfully processed and an association was created.

ExtraDevice

A device, returned in the activity result of the IntentSender received in Callback#onDeviceFound

        Type is:
        &lt;ul&gt;
            &lt;li&gt;for classic Bluetooth - <code data-dev-comment-type="c">android.bluetooth.BluetoothDevice</code>&lt;/li&gt;
            &lt;li&gt;for Bluetooth LE - <code data-dev-comment-type="c">android.bluetooth.le.ScanResult</code>&lt;/li&gt;
            &lt;li&gt;for WiFi - <code data-dev-comment-type="c">android.net.wifi.ScanResult</code>&lt;/li&gt;
        &lt;/ul&gt;
FlagCallMetadata
Obsolete.

Used by #enableSystemDataSync(int, int)}.

ResultCanceled
Obsolete.

The result code to propagate back to the user activity, indicates if the association dialog is implicitly cancelled.

ResultDiscoveryTimeout
Obsolete.

The result code to propagate back to the user activity, indicates the association dialog is dismissed if there's no device found after 20 seconds.

ResultInternalError
Obsolete.

The result code to propagate back to the user activity, indicates the internal error in CompanionDeviceManager.

ResultOk
Obsolete.

The result code to propagate back to the user activity, indicates the association is created successfully.

ResultUserRejected
Obsolete.

The result code to propagate back to the user activity, indicates the association dialog is explicitly declined by the users.

Properties

Associations

Calling this API requires a uses-feature PackageManager#FEATURE_COMPANION_DEVICE_SETUP declaration in the manifest

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
MyAssociations

Calling this API requires a uses-feature PackageManager#FEATURE_COMPANION_DEVICE_SETUP declaration in the manifest

PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)

Methods

Associate(AssociationRequest, CompanionDeviceManager+Callback, Handler)

Associate this app with a companion device, selected by user

Associate(AssociationRequest, IExecutor, CompanionDeviceManager+Callback)
AttachSystemDataTransport(Int32, Stream, Stream)

Attach a bidirectional communication stream to be used as a transport channel for transporting system data between associated devices.

BuildAssociationCancellationIntent()

Cancel the current association activity.

BuildPermissionTransferUserConsentIntent(Int32)

Build a permission sync user consent dialog.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
DetachSystemDataTransport(Int32)

Detach the transport channel that's previously attached for the associated device.

DisableSystemDataSyncForTypes(Int32, SystemDataSyncFlags)

Disable system data sync (it only supports call metadata sync for now).

Disassociate(Int32)

Remove an association.

Disassociate(String)

Remove the association between this app and the device with the given mac address.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
EnableSystemDataSyncForTypes(Int32, SystemDataSyncFlags)

Enable system data sync (it only supports call metadata sync for now).

Equals(Object)

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

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
HasNotificationAccess(ComponentName)

Check whether the given component can access the notifications via a NotificationListenerService

        Your app must have an association with a device before calling this API
JavaFinalize()

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

(Inherited from Object)
Notify()

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

(Inherited from Object)
NotifyAll()

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

(Inherited from Object)
RequestNotificationAccess(ComponentName)

Request notification access for the given component.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
StartObservingDevicePresence(String)

Register to receive callbacks whenever the associated device comes in and out of range.

StartSystemDataTransfer(Int32, IExecutor, IOutcomeReceiver)

Start system data transfer which has been previously approved by the user.

StopObservingDevicePresence(String)

Unregister for receiving callbacks whenever the associated device comes in and out of range.

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64)

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

(Inherited from Object)
Wait(Int64, Int32)

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

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to