Language

NsdManager.CheckPermissionForService Method

Definition

Check whether the caller can register service info callbacks or resolve 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 IntConsumer to receive the permission check result code; will be either #SERVICE_PERMISSION_GRANTED or #SERVICE_PERMISSION_DENIED.

Attributes

Remarks

Check whether the caller can register service info callbacks or resolve a service.

Starting from target SDK Build.VERSION_CODES.CINNAMON_BUN, unless apps have the Manifest.permission.ACCESS_LOCAL_NETWORK permission, they can only register service info callbacks or resolve services that were selected in a UI picker, as per DiscoveryRequest.FLAG_SHOW_PICKER.

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 resultReceiver will be called using the provided Executor with either SERVICE_PERMISSION_GRANTED or SERVICE_PERMISSION_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