Language

NsdManager.CheckPermissionForService Method

Definition

Checks whether the caller has stored approval for a service.

[Android.Runtime.Register("checkPermissionForService", "(Ljava/lang/String;Ljava/lang/String;Ljava/util/concurrent/Executor;Ljava/util/function/IntConsumer;)V", "", ApiSince=37)]
public void CheckPermissionForService(string serviceName, string serviceType, Java.Util.Concurrent.IExecutor executor, Java.Util.Functions.IIntConsumer resultReceiver);
[<Android.Runtime.Register("checkPermissionForService", "(Ljava/lang/String;Ljava/lang/String;Ljava/util/concurrent/Executor;Ljava/util/function/IntConsumer;)V", "", ApiSince=37)>]
member this.CheckPermissionForService : string * string * Java.Util.Concurrent.IExecutor * Java.Util.Functions.IIntConsumer -> unit

Parameters

serviceName
String

Instance name of the service

serviceType
String

Type of the service, e.g. _ipp._tcp

executor
IExecutor

The Executor on which to invoke the receiver.

resultReceiver
IIntConsumer

The receiver for the integer value of Granted or Denied.

Attributes

Remarks

Checks whether the caller has stored approval for a service. This does not check all permissions that can allow access.

For apps that target Android 17 (API level 37) or later, unless they have the android.permission.ACCESS_LOCAL_NETWORK permission, they can only register service info callbacks or resolve services selected in a UI picker, as provided by FlagShowPicker.

The system will remember whether a user has selected a service in the past, but access may be revoked for storage reasons or by the user. This method allows checking whether access to the service was granted in the picker and not revoked.

The receiver is called using the provided executor with the integer value of Granted or Denied.

Android reference for android.net.nsd.NsdManager.checkPermissionForService.

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