# NetworkLocation

public final class **NetworkLocation** extends [Object](https://developer.android.com/reference/java/lang/Object.html)  
implements [Parcelable](https://developer.android.com/reference/android/os/Parcelable.html) Represents a network location at which a particular service can be reached.

### Inherited Constant Summary

From interface android.os.Parcelable

|---|---|---|
| int | CONTENTS_FILE_DESCRIPTOR |   |
| int | PARCELABLE_STABILITY_LOCAL |   |
| int | PARCELABLE_STABILITY_VINTF |   |
| int | PARCELABLE_WRITE_RETURN_VALUE |   |

### Public Method Summary

|---|---|
| static [NetworkLocation](https://developers.home.google.com/android/reference/com/google/android/gms/home/matter/common/NetworkLocation) | [create](https://developers.home.google.com/android/reference/com/google/android/gms/home/matter/common/NetworkLocation#create(java.lang.String,%20int))([String](https://developer.android.com/reference/java/lang/String.html) ipAddress, int port) Returns a new `https://developers.home.google.com/android/reference/com/google/android/gms/home/matter/common/NetworkLocation` instance for the given `ipAddress` string and {code port}. |
| static [NetworkLocation](https://developers.home.google.com/android/reference/com/google/android/gms/home/matter/common/NetworkLocation) | [create](https://developers.home.google.com/android/reference/com/google/android/gms/home/matter/common/NetworkLocation#create(java.net.InetAddress,%20int))([InetAddress](https://developer.android.com/reference/java/net/InetAddress.html) ipAddress, int port) Returns a new `https://developers.home.google.com/android/reference/com/google/android/gms/home/matter/common/NetworkLocation` instance for the given `ipAddress` and `port`. |
| boolean | [equals](https://developers.home.google.com/android/reference/com/google/android/gms/home/matter/common/NetworkLocation#equals(java.lang.Object))([Object](https://developer.android.com/reference/java/lang/Object.html) other) |
| [String](https://developer.android.com/reference/java/lang/String.html) | [getFormattedIpAddress](https://developers.home.google.com/android/reference/com/google/android/gms/home/matter/common/NetworkLocation#getFormattedIpAddress())() Returns the IP address as a formatted string, including the scope ID if the IP address is an IPv6 address with the scope ID specified. |
| [InetAddress](https://developer.android.com/reference/java/net/InetAddress.html) | [getIpAddress](https://developers.home.google.com/android/reference/com/google/android/gms/home/matter/common/NetworkLocation#getIpAddress())() Returns the IP address associated with this location. |
| int | [getPort](https://developers.home.google.com/android/reference/com/google/android/gms/home/matter/common/NetworkLocation#getPort())() Returns the port on the associated IP address associated with this location. |
| int | [hashCode](https://developers.home.google.com/android/reference/com/google/android/gms/home/matter/common/NetworkLocation#hashCode())() |
| [String](https://developer.android.com/reference/java/lang/String.html) | [toString](https://developers.home.google.com/android/reference/com/google/android/gms/home/matter/common/NetworkLocation#toString())() |
| void | [writeToParcel](https://developers.home.google.com/android/reference/com/google/android/gms/home/matter/common/NetworkLocation#writeToParcel(android.os.Parcel,%20int))([Parcel](https://developer.android.com/reference/android/os/Parcel.html) dest, int flags) |

### Inherited Method Summary

From class java.lang.Object

|---|---|
| [Object](https://developer.android.com/reference/java/lang/Object.html) | clone() |
| boolean | equals([Object](https://developer.android.com/reference/java/lang/Object.html) arg0) |
| void | finalize() |
| final [Class](https://developer.android.com/reference/java/lang/Class.html)\<?\> | getClass() |
| int | hashCode() |
| final void | notify() |
| final void | notifyAll() |
| [String](https://developer.android.com/reference/java/lang/String.html) | toString() |
| final void | wait(long arg0, int arg1) |
| final void | wait(long arg0) |
| final void | wait() |

From interface android.os.Parcelable

|---|---|
| abstract int | describeContents() |
| abstract void | writeToParcel([Parcel](https://developer.android.com/reference/android/os/Parcel.html) arg0, int arg1) |

## Public Methods

#### public static [NetworkLocation](https://developers.home.google.com/android/reference/com/google/android/gms/home/matter/common/NetworkLocation)
**create** ([String](https://developer.android.com/reference/java/lang/String.html) ipAddress, int port)

Returns a new `https://developers.home.google.com/android/reference/com/google/android/gms/home/matter/common/NetworkLocation`
instance for the given `ipAddress` string and {code port}. If the IP address
string includes a scope ID (e.g. fe80::0:2%43) this scope will be included in the
`https://developer.android.com/reference/java/net/Inet6Address.html`.

##### Throws

| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException.html) | if the `ipAddress` is malformed |
|---|---|

#### public static [NetworkLocation](https://developers.home.google.com/android/reference/com/google/android/gms/home/matter/common/NetworkLocation)
**create** ([InetAddress](https://developer.android.com/reference/java/net/InetAddress.html) ipAddress, int port)

Returns a new `https://developers.home.google.com/android/reference/com/google/android/gms/home/matter/common/NetworkLocation`
instance for the given `ipAddress` and `port`.

#### public boolean **equals** ([Object](https://developer.android.com/reference/java/lang/Object.html) other)

#### public [String](https://developer.android.com/reference/java/lang/String.html) **getFormattedIpAddress** ()

Returns the IP address as a formatted string, including the scope ID if the IP
address is an IPv6 address with the scope ID specified. (e.g. fe80::0:2%47)

#### public [InetAddress](https://developer.android.com/reference/java/net/InetAddress.html)
**getIpAddress** ()

Returns the IP address associated with this location.

#### public int **getPort** ()

Returns the port on the associated IP address associated with this location.

#### public int **hashCode** ()

#### public [String](https://developer.android.com/reference/java/lang/String.html) **toString** ()

#### public void **writeToParcel** ([Parcel](https://developer.android.com/reference/android/os/Parcel.html) dest, int flags)