Share via


CompanionDeviceService.ServiceInterface Field

Definition

An intent action for a service to be bound whenever this app's companion device(s) are nearby or self-managed device(s) report app appeared.

[Android.Runtime.Register("SERVICE_INTERFACE", ApiSince=31)]
public const string ServiceInterface;
[<Android.Runtime.Register("SERVICE_INTERFACE", ApiSince=31)>]
val mutable ServiceInterface : string

Field Value

Attributes

Remarks

An intent action for a service to be bound whenever this app's companion device(s) are nearby or self-managed device(s) report app appeared.

The app will be kept bound by the system when one of the DevicePresenceEvent#EVENT_BLE_APPEARED, DevicePresenceEvent#EVENT_BT_CONNECTED, DevicePresenceEvent#EVENT_SELF_MANAGED_APPEARED event is notified.

If the app is not running when one of the DevicePresenceEvent#EVENT_BLE_APPEARED, DevicePresenceEvent#EVENT_BT_CONNECTED, DevicePresenceEvent#EVENT_SELF_MANAGED_APPEARED event is notified, the app will be kept bound by the system.

Shortly, the service will be unbound if both DevicePresenceEvent#EVENT_BLE_DISAPPEARED and DevicePresenceEvent#EVENT_BT_DISCONNECTED are notified, or DevicePresenceEvent#EVENT_SELF_MANAGED_DISAPPEARED event is notified. The app will be eligible for cleanup, unless any other user-visible components are running.

If running in background is not essential for the devices that this app can manage, app should avoid declaring this service.</p>

The service must also require permission android.Manifest.permission#BIND_COMPANION_DEVICE_SERVICE

Java documentation for android.companion.CompanionDeviceService.SERVICE_INTERFACE.

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