Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/net/DnsResolver#nestedclasses) \| [Constants](https://developer.android.com/reference/android/net/DnsResolver#constants) \| [Ctors](https://developer.android.com/reference/android/net/DnsResolver#pubctors) \| [Methods](https://developer.android.com/reference/android/net/DnsResolver#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/net/DnsResolver#inhmethods)

# DnsResolver

*** ** * ** ***


`
public

final

class
DnsResolver
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.net.DnsResolver |

<br />

*** ** * ** ***

Dns resolver class for asynchronous dns querying

Note that if a client sends a query with more than 1 record in the question section but
the remote dns server does not support this, it may not respond at all, leading to a timeout.

## Summary

| ### Nested classes ||
|---|---|
| ` interface` | `https://developer.android.com/reference/android/net/DnsResolver.Callback<T>` Base interface for answer callbacks |
| ` class` | `https://developer.android.com/reference/android/net/DnsResolver.DnsException` Class to represent DNS error |

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/net/DnsResolver#CLASS_IN` |
| `int` | `https://developer.android.com/reference/android/net/DnsResolver#ERROR_PARSE` Indicates that there was an error parsing the response the query. |
| `int` | `https://developer.android.com/reference/android/net/DnsResolver#ERROR_SYSTEM` Indicates that there was an error sending the query. |
| `int` | `https://developer.android.com/reference/android/net/DnsResolver#FLAG_EMPTY` |
| `int` | `https://developer.android.com/reference/android/net/DnsResolver#FLAG_NO_CACHE_LOOKUP` |
| `int` | `https://developer.android.com/reference/android/net/DnsResolver#FLAG_NO_CACHE_STORE` |
| `int` | `https://developer.android.com/reference/android/net/DnsResolver#FLAG_NO_RETRY` |
| `int` | `https://developer.android.com/reference/android/net/DnsResolver#HTTPS_QUERY_WAIT_AUTO` Indicates that the default wait time should be used for the HTTPS query. |
| `int` | `https://developer.android.com/reference/android/net/DnsResolver#HTTPS_QUERY_WAIT_NONE` Indicates that no additional wait should be used for the HTTPS query. |
| `int` | `https://developer.android.com/reference/android/net/DnsResolver#HTTPS_QUERY_WAIT_UNTIL_TIMEOUT` Indicates that the HTTPS query will be retransmitted until it gets a response, or until it times out. |
| `int` | `https://developer.android.com/reference/android/net/DnsResolver#TYPE_A` |
| `int` | `https://developer.android.com/reference/android/net/DnsResolver#TYPE_AAAA` |
| `int` | `https://developer.android.com/reference/android/net/DnsResolver#TYPE_HTTPS` |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/net/DnsResolver#DnsResolver(android.content.Context,%20android.os.Looper)(https://developer.android.com/reference/android/content/Context context, https://developer.android.com/reference/android/os/Looper looper) ` Creates a `https://developer.android.com/reference/android/net/DnsResolver` instance. |

| ### Public methods ||
|---|---|
| ` static https://developer.android.com/reference/android/net/DnsResolver` | ` https://developer.android.com/reference/android/net/DnsResolver#getInstance()() ` *This method was deprecated in API level 37. Use `https://developer.android.com/reference/android/net/DnsResolver#DnsResolver(android.content.Context,%20android.os.Looper)` instead.* |
| ` void` | ` https://developer.android.com/reference/android/net/DnsResolver#query(android.net.Network,%20java.lang.String,%20int,%20java.util.concurrent.Executor,%20int,%20android.os.CancellationSignal,%20android.net.DnsResolver.Callback<android.net.dns.HttpsEndpoint>)(https://developer.android.com/reference/android/net/Network network, https://developer.android.com/reference/java/lang/String domain, int flags, https://developer.android.com/reference/java/util/concurrent/Executor executor, int httpsTimeoutMillis, https://developer.android.com/reference/android/os/CancellationSignal cancellationSignal, https://developer.android.com/reference/android/net/DnsResolver.Callback<https://developer.android.com/reference/android/net/dns/HttpsEndpoint> callback) ` Send concurrent A/AAAA/HTTPS DNS queries with the specified name on a network. |
| ` void` | ` https://developer.android.com/reference/android/net/DnsResolver#query(android.net.Network,%20java.lang.String,%20int,%20java.util.concurrent.Executor,%20android.os.CancellationSignal,%20android.net.DnsResolver.Callback<?%20super%20java.util.List<java.net.InetAddress>>)(https://developer.android.com/reference/android/net/Network network, https://developer.android.com/reference/java/lang/String domain, int flags, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/os/CancellationSignal cancellationSignal, https://developer.android.com/reference/android/net/DnsResolver.Callback<? super https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/net/InetAddress>> callback) ` Send a DNS query with the specified name on a network with both IPv4 and IPv6, get back a set of InetAddresses with rfc6724 sorting asynchronously. |
| ` void` | ` https://developer.android.com/reference/android/net/DnsResolver#query(android.net.Network,%20java.lang.String,%20int,%20int,%20java.util.concurrent.Executor,%20android.os.CancellationSignal,%20android.net.DnsResolver.Callback<?%20super%20java.util.List<java.net.InetAddress>>)(https://developer.android.com/reference/android/net/Network network, https://developer.android.com/reference/java/lang/String domain, int nsType, int flags, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/os/CancellationSignal cancellationSignal, https://developer.android.com/reference/android/net/DnsResolver.Callback<? super https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/net/InetAddress>> callback) ` Send a DNS query with the specified name and query type, get back a set of InetAddresses with rfc6724 sorting asynchronously. |
| ` void` | ` https://developer.android.com/reference/android/net/DnsResolver#rawQuery(android.net.Network,%20byte[],%20int,%20java.util.concurrent.Executor,%20android.os.CancellationSignal,%20android.net.DnsResolver.Callback<?%20super%20byte[]>)(https://developer.android.com/reference/android/net/Network network, byte[] query, int flags, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/os/CancellationSignal cancellationSignal, https://developer.android.com/reference/android/net/DnsResolver.Callback<? super byte[]> callback) ` Send a raw DNS query. |
| ` void` | ` https://developer.android.com/reference/android/net/DnsResolver#rawQuery(android.net.Network,%20java.lang.String,%20int,%20int,%20int,%20java.util.concurrent.Executor,%20android.os.CancellationSignal,%20android.net.DnsResolver.Callback<?%20super%20byte[]>)(https://developer.android.com/reference/android/net/Network network, https://developer.android.com/reference/java/lang/String domain, int nsClass, int nsType, int flags, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/os/CancellationSignal cancellationSignal, https://developer.android.com/reference/android/net/DnsResolver.Callback<? super byte[]> callback) ` Send a DNS query with the specified name, class and query type. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||

## Constants

### CLASS_IN

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int CLASS_IN
```

<br />

<br />

Constant Value:

1
(0x00000001)


### ERROR_PARSE

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ERROR_PARSE
```

Indicates that there was an error parsing the response the query.
The cause of this error is available via getCause() and is a `https://developer.android.com/reference/android/net/ParseException`.

<br />

Constant Value:

0
(0x00000000)


### ERROR_SYSTEM

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ERROR_SYSTEM
```

Indicates that there was an error sending the query.
The cause of this error is available via getCause() and is an ErrnoException.

<br />

Constant Value:

1
(0x00000001)


### FLAG_EMPTY

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FLAG_EMPTY
```

<br />

<br />

Constant Value:

0
(0x00000000)


### FLAG_NO_CACHE_LOOKUP

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FLAG_NO_CACHE_LOOKUP
```

<br />

<br />

Constant Value:

4
(0x00000004)


### FLAG_NO_CACHE_STORE

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FLAG_NO_CACHE_STORE
```

<br />

<br />

Constant Value:

2
(0x00000002)


### FLAG_NO_RETRY

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FLAG_NO_RETRY
```

<br />

<br />

Constant Value:

1
(0x00000001)


### HTTPS_QUERY_WAIT_AUTO

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 22](https://developer.android.com/sdkExtensions)

```
public static final int HTTPS_QUERY_WAIT_AUTO
```

Indicates that the default wait time should be used for the HTTPS query.

This option balances the extra latency of waiting for the HTTPS record with the latency
and security benefits of receiving it.

<br />

Constant Value:

-1
(0xffffffff)


### HTTPS_QUERY_WAIT_NONE

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 22](https://developer.android.com/sdkExtensions)

```
public static final int HTTPS_QUERY_WAIT_NONE
```

Indicates that no additional wait should be used for the HTTPS query.

This option means the callback will be called immediately as soon as the IP address
queries have received a response, regardless of whether the HTTPS query has received a
response or not.

This option is not recommended for security or latency because it may result
in HTTPS records not being returned even if they exist.

<br />

Constant Value:

0
(0x00000000)


### HTTPS_QUERY_WAIT_UNTIL_TIMEOUT

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 22](https://developer.android.com/sdkExtensions)

```
public static final int HTTPS_QUERY_WAIT_UNTIL_TIMEOUT
```

Indicates that the HTTPS query will be retransmitted until it gets a response, or until it
times out.

This option may increase latency if the HTTPS query is dropped by the network.

<br />

Constant Value:

-2
(0xfffffffe)


### TYPE_A

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int TYPE_A
```

<br />

<br />

Constant Value:

1
(0x00000001)


### TYPE_AAAA

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int TYPE_AAAA
```

<br />

<br />

Constant Value:

28
(0x0000001c)


### TYPE_HTTPS

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 22](https://developer.android.com/sdkExtensions)

```
public static final int TYPE_HTTPS
```

<br />

<br />

Constant Value:

65
(0x00000041)


## Public constructors

### DnsResolver

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 22](https://developer.android.com/sdkExtensions)

```
public DnsResolver (Context context, 
                Looper looper)
```

Creates a `https://developer.android.com/reference/android/net/DnsResolver` instance.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: used for internal interactions with other system services. This value cannot be `null`. <br /> |
| `looper` | `Looper`: `https://developer.android.com/reference/android/os/Looper` for monitoring incoming replies to DNS queries. If null, then uses the value returned by `https://developer.android.com/reference/android/os/Looper#getMainLooper()`. The specified `https://developer.android.com/reference/android/os/Looper` is not used for executing method callbacks, but if a separate thread is already being used for `https://developer.android.com/reference/android/net/DnsResolver` interactions, it is sufficient to use `https://developer.android.com/reference/java/lang/Runnable#run()` as the `https://developer.android.com/reference/java/util/concurrent/Executor` for `https://developer.android.com/reference/android/net/DnsResolver#query(android.net.Network,%20java.lang.String,%20int,%20int,%20java.util.concurrent.Executor,%20android.os.CancellationSignal,%20android.net.DnsResolver.Callback<?%20super%20java.util.List<java.net.InetAddress>>)` and `https://developer.android.com/reference/android/net/DnsResolver#rawQuery(android.net.Network,%20byte[],%20int,%20java.util.concurrent.Executor,%20android.os.CancellationSignal,%20android.net.DnsResolver.Callback<?%20super%20byte[]>)`. |

## Public methods

### getInstance

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static DnsResolver getInstance ()
```


**This method was deprecated
in API level 37.**   

Use `https://developer.android.com/reference/android/net/DnsResolver#DnsResolver(android.content.Context,%20android.os.Looper)` instead.

Get instance for DnsResolver

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/DnsResolver` | This value cannot be `null`. <br /> |

### query

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 22](https://developer.android.com/sdkExtensions)

```
public void query (Network network, 
                String domain, 
                int flags, 
                Executor executor, 
                int httpsTimeoutMillis, 
                CancellationSignal cancellationSignal, 
                Callback<HttpsEndpoint> callback)
```

Send concurrent A/AAAA/HTTPS DNS queries with the specified name on a network.

The answer to all queries will be provided asynchronously through the provided
`callback` `https://developer.android.com/reference/android/net/DnsResolver.Callback`, which provides a `https://developer.android.com/reference/android/net/dns/HttpsEndpoint`.

<br />

| Parameters ||
|---|---|
| `network` | `Network`: `https://developer.android.com/reference/android/net/Network` specifying which network to query on. `null` for query on default network. <br /> |
| `domain` | `String`: domain name to query. This value cannot be `null`. <br /> |
| `flags` | `int`: flags as a combination of the FLAGS_\* constants. Value is one of the following: - `https://developer.android.com/reference/android/net/DnsResolver#FLAG_EMPTY` - `https://developer.android.com/reference/android/net/DnsResolver#FLAG_NO_RETRY` - `https://developer.android.com/reference/android/net/DnsResolver#FLAG_NO_CACHE_STORE` - `https://developer.android.com/reference/android/net/DnsResolver#FLAG_NO_CACHE_LOOKUP` |
| `executor` | `Executor`: The `https://developer.android.com/reference/java/util/concurrent/Executor` that the callback should be executed on. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `httpsTimeoutMillis` | `int`: the timeout in milliseconds to wait for the HTTPS query to complete after the A/AAAA queries have already completed. May be set to `https://developer.android.com/reference/android/net/DnsResolver#HTTPS_QUERY_WAIT_NONE` to disable any additional wait, `https://developer.android.com/reference/android/net/DnsResolver#HTTPS_QUERY_WAIT_AUTO` to use the default wait time, `https://developer.android.com/reference/android/net/DnsResolver#HTTPS_QUERY_WAIT_UNTIL_TIMEOUT` to wait for the HTTPS query to complete, or a specific value in milliseconds. <br /> |
| `cancellationSignal` | `CancellationSignal`: used by the caller to signal if all the queries should be cancelled. May be `null`. <br /> |
| `callback` | `Callback`: a `https://developer.android.com/reference/android/net/DnsResolver.Callback` which will be called to notify the caller of the results of the A/AAAA/HTTPS DNS queries. Will return a `https://developer.android.com/reference/android/net/DnsResolver#ERROR_PARSE` if any of the DNS records cannot be parsed, and should be treated as a resolution failure. This value cannot be `null`. <br /> |

### query

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 22](https://developer.android.com/sdkExtensions)

```
public void query (Network network, 
                String domain, 
                int flags, 
                Executor executor, 
                CancellationSignal cancellationSignal, 
                Callback<? super List<InetAddress>> callback)
```

Send a DNS query with the specified name on a network with both IPv4 and IPv6,
get back a set of InetAddresses with rfc6724 sorting asynchronously.

This method will examine the connection ability on given network, and query IPv4
and IPv6 if connection is available. This method will send A queries if the specified
`Network` provides IPv4 connectivity, and AAAA queries if it provides IPv6
connectivity.

If at least one query succeeded with valid answer, rcode will be 0

The answer will be provided asynchronously through the provided `https://developer.android.com/reference/android/net/DnsResolver.Callback`.

<br />

| Parameters ||
|---|---|
| `network` | `Network`: `https://developer.android.com/reference/android/net/Network` specifying which network to query on. `null` for query on default network. <br /> |
| `domain` | `String`: domain name to query. This value cannot be `null`. <br /> |
| `flags` | `int`: flags as a combination of the FLAGS_\* constants. Value is one of the following: - `https://developer.android.com/reference/android/net/DnsResolver#FLAG_EMPTY` - `https://developer.android.com/reference/android/net/DnsResolver#FLAG_NO_RETRY` - `https://developer.android.com/reference/android/net/DnsResolver#FLAG_NO_CACHE_STORE` - `https://developer.android.com/reference/android/net/DnsResolver#FLAG_NO_CACHE_LOOKUP` |
| `executor` | `Executor`: The `https://developer.android.com/reference/java/util/concurrent/Executor` that the callback should be executed on. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `cancellationSignal` | `CancellationSignal`: used by the caller to signal if the query should be cancelled. May be `null`. <br /> |
| `callback` | `Callback`: a `https://developer.android.com/reference/android/net/DnsResolver.Callback` which will be called to notify the caller of the result of dns query. This value cannot be `null`. <br /> |

### query

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [S Extensions 22](https://developer.android.com/sdkExtensions)

```
public void query (Network network, 
                String domain, 
                int nsType, 
                int flags, 
                Executor executor, 
                CancellationSignal cancellationSignal, 
                Callback<? super List<InetAddress>> callback)
```

Send a DNS query with the specified name and query type, get back a set of
InetAddresses with rfc6724 sorting asynchronously.

The answer will be provided asynchronously through the provided `https://developer.android.com/reference/android/net/DnsResolver.Callback`.

<br />

| Parameters ||
|---|---|
| `network` | `Network`: `https://developer.android.com/reference/android/net/Network` specifying which network to query on. `null` for query on default network. <br /> |
| `domain` | `String`: domain name to query. This value cannot be `null`. <br /> |
| `nsType` | `int`: dns resource record (RR) type as one of the TYPE_\* constants. Value is one of the following: - `https://developer.android.com/reference/android/net/DnsResolver#TYPE_A` - `https://developer.android.com/reference/android/net/DnsResolver#TYPE_AAAA` - `https://developer.android.com/reference/android/net/DnsResolver#TYPE_HTTPS` |
| `flags` | `int`: flags as a combination of the FLAGS_\* constants. Value is one of the following: - `https://developer.android.com/reference/android/net/DnsResolver#FLAG_EMPTY` - `https://developer.android.com/reference/android/net/DnsResolver#FLAG_NO_RETRY` - `https://developer.android.com/reference/android/net/DnsResolver#FLAG_NO_CACHE_STORE` - `https://developer.android.com/reference/android/net/DnsResolver#FLAG_NO_CACHE_LOOKUP` |
| `executor` | `Executor`: The `https://developer.android.com/reference/java/util/concurrent/Executor` that the callback should be executed on. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `cancellationSignal` | `CancellationSignal`: used by the caller to signal if the query should be cancelled. May be `null`. <br /> |
| `callback` | `Callback`: a `https://developer.android.com/reference/android/net/DnsResolver.Callback` which will be called to notify the caller of the result of dns query. This value cannot be `null`. <br /> |

### rawQuery

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void rawQuery (Network network, 
                byte[] query, 
                int flags, 
                Executor executor, 
                CancellationSignal cancellationSignal, 
                Callback<? super byte[]> callback)
```

Send a raw DNS query.
The answer will be provided asynchronously through the provided `https://developer.android.com/reference/android/net/DnsResolver.Callback`.

<br />

| Parameters ||
|---|---|
| `network` | `Network`: `https://developer.android.com/reference/android/net/Network` specifying which network to query on. `null` for query on default network. <br /> |
| `query` | `byte`: blob message to query. This value cannot be `null`. <br /> |
| `flags` | `int`: flags as a combination of the FLAGS_\* constants. Value is one of the following: - `https://developer.android.com/reference/android/net/DnsResolver#FLAG_EMPTY` - `https://developer.android.com/reference/android/net/DnsResolver#FLAG_NO_RETRY` - `https://developer.android.com/reference/android/net/DnsResolver#FLAG_NO_CACHE_STORE` - `https://developer.android.com/reference/android/net/DnsResolver#FLAG_NO_CACHE_LOOKUP` |
| `executor` | `Executor`: The `https://developer.android.com/reference/java/util/concurrent/Executor` that the callback should be executed on. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `cancellationSignal` | `CancellationSignal`: used by the caller to signal if the query should be cancelled. May be `null`. <br /> |
| `callback` | `Callback`: a `https://developer.android.com/reference/android/net/DnsResolver.Callback` which will be called to notify the caller of the result of dns query. This value cannot be `null`. <br /> |

### rawQuery

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void rawQuery (Network network, 
                String domain, 
                int nsClass, 
                int nsType, 
                int flags, 
                Executor executor, 
                CancellationSignal cancellationSignal, 
                Callback<? super byte[]> callback)
```

Send a DNS query with the specified name, class and query type.
The answer will be provided asynchronously through the provided `https://developer.android.com/reference/android/net/DnsResolver.Callback`.

<br />

| Parameters ||
|---|---|
| `network` | `Network`: `https://developer.android.com/reference/android/net/Network` specifying which network to query on. `null` for query on default network. <br /> |
| `domain` | `String`: domain name to query. This value cannot be `null`. <br /> |
| `nsClass` | `int`: dns class as one of the CLASS_\* constants. Value is one of the following: - `https://developer.android.com/reference/android/net/DnsResolver#CLASS_IN` |
| `nsType` | `int`: dns resource record (RR) type as one of the TYPE_\* constants. Value is one of the following: - `https://developer.android.com/reference/android/net/DnsResolver#TYPE_A` - `https://developer.android.com/reference/android/net/DnsResolver#TYPE_AAAA` - `https://developer.android.com/reference/android/net/DnsResolver#TYPE_HTTPS` |
| `flags` | `int`: flags as a combination of the FLAGS_\* constants. Value is one of the following: - `https://developer.android.com/reference/android/net/DnsResolver#FLAG_EMPTY` - `https://developer.android.com/reference/android/net/DnsResolver#FLAG_NO_RETRY` - `https://developer.android.com/reference/android/net/DnsResolver#FLAG_NO_CACHE_STORE` - `https://developer.android.com/reference/android/net/DnsResolver#FLAG_NO_CACHE_LOOKUP` |
| `executor` | `Executor`: The `https://developer.android.com/reference/java/util/concurrent/Executor` that the callback should be executed on. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `cancellationSignal` | `CancellationSignal`: used by the caller to signal if the query should be cancelled. May be `null`. <br /> |
| `callback` | `Callback`: a `https://developer.android.com/reference/android/net/DnsResolver.Callback` which will be called to notify the caller of the result of dns query. This value cannot be `null`. <br /> |