Sdílet prostřednictvím


CompanionDeviceManager.RequestNotificationAccess(ComponentName) Method

Definition

Request notification access for the given component.

[Android.Runtime.Register("requestNotificationAccess", "(Landroid/content/ComponentName;)V", "", ApiSince=26)]
public void RequestNotificationAccess (Android.Content.ComponentName? component);
[<Android.Runtime.Register("requestNotificationAccess", "(Landroid/content/ComponentName;)V", "", ApiSince=26)>]
member this.RequestNotificationAccess : Android.Content.ComponentName -> unit

Parameters

component
ComponentName
Attributes

Remarks

Request notification access for the given component.

The given component must follow the protocol specified in NotificationListenerService

Only components from the same ComponentName#getPackageName package as the calling app are allowed.

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

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

Java documentation for android.companion.CompanionDeviceManager.requestNotificationAccess(android.content.ComponentName).

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