Share via


NsdServiceInfo.SetAttribute(String, String) Method

Definition

Add a service attribute as a key/value pair.

[Android.Runtime.Register("setAttribute", "(Ljava/lang/String;Ljava/lang/String;)V", "")]
public void SetAttribute (string? key, string? value);
[<Android.Runtime.Register("setAttribute", "(Ljava/lang/String;Ljava/lang/String;)V", "")>]
member this.SetAttribute : string * string -> unit

Parameters

key
String
value
String
Attributes

Remarks

Add a service attribute as a key/value pair.

Service attributes are included as DNS-SD TXT record pairs.

The key must be US-ASCII printable characters, excluding the '=' character. Values may be UTF-8 strings or null. The total length of key + value must be less than 255 bytes.

Keys should be short, ideally no more than 9 characters, and unique per instance of NsdServiceInfo. Calling #setAttribute twice with the same key will overwrite first value.

Java documentation for android.net.nsd.NsdServiceInfo.setAttribute(java.lang.String, java.lang.String).

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