DevicePolicyManager.SetGlobalPrivateDnsModeSpecifiedHost Method

Definition

Sets the global Private DNS host to be used.

[Android.Runtime.Register("setGlobalPrivateDnsModeSpecifiedHost", "(Landroid/content/ComponentName;Ljava/lang/String;)I", "GetSetGlobalPrivateDnsModeSpecifiedHost_Landroid_content_ComponentName_Ljava_lang_String_Handler", ApiSince=29)]
public virtual Android.App.Admin.PrivateDnsSet SetGlobalPrivateDnsModeSpecifiedHost (Android.Content.ComponentName admin, string privateDnsHost);
[<Android.Runtime.Register("setGlobalPrivateDnsModeSpecifiedHost", "(Landroid/content/ComponentName;Ljava/lang/String;)I", "GetSetGlobalPrivateDnsModeSpecifiedHost_Landroid_content_ComponentName_Ljava_lang_String_Handler", ApiSince=29)>]
abstract member SetGlobalPrivateDnsModeSpecifiedHost : Android.Content.ComponentName * string -> Android.App.Admin.PrivateDnsSet
override this.SetGlobalPrivateDnsModeSpecifiedHost : Android.Content.ComponentName * string -> Android.App.Admin.PrivateDnsSet

Parameters

admin
ComponentName

which DeviceAdminReceiver this request is associated with.

privateDnsHost
String

The hostname of a server that implements DNS over TLS (RFC7858).

Returns

PRIVATE_DNS_SET_NO_ERROR if the mode was set successfully, PRIVATE_DNS_SET_ERROR_FAILURE_SETTING if it could not be set or PRIVATE_DNS_SET_ERROR_HOST_NOT_SERVING if the specified host does not implement RFC7858.

Attributes

Remarks

Sets the global Private DNS host to be used. May only be called by the device owner.

Note that the method is blocking as it will perform a connectivity check to the resolver, to ensure it is valid. Because of that, the method should not be called on any thread that relates to user interaction, such as the UI thread.

In case a VPN is used in conjunction with Private DNS resolver, the Private DNS resolver must be reachable both from within and outside the VPN. Otherwise, the device may lose the ability to resolve hostnames as system traffic to the resolver may not go through the VPN.

Note: The device owner won't be able to set the global private DNS mode if there are unaffiliated secondary users or profiles on the device. It's recommended that affiliation ids are set for new users as soon as possible after provisioning via #setAffiliationIds.

Java documentation for android.app.admin.DevicePolicyManager.setGlobalPrivateDnsModeSpecifiedHost(android.content.ComponentName, 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