Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/android/telephony/ServiceState#constants) \| [Inherited Constants](https://developer.android.com/reference/android/telephony/ServiceState#inhconstants) \| [Fields](https://developer.android.com/reference/android/telephony/ServiceState#lfields) \| [Ctors](https://developer.android.com/reference/android/telephony/ServiceState#pubctors) \| [Methods](https://developer.android.com/reference/android/telephony/ServiceState#pubmethods) \| [Protected Methods](https://developer.android.com/reference/android/telephony/ServiceState#promethods) \| [Inherited Methods](https://developer.android.com/reference/android/telephony/ServiceState#inhmethods)

# ServiceState

*** ** * ** ***

` public class ServiceState `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/android/os/Parcelable `

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

<br />

*** ** * ** ***

Contains phone state and service related information. The following phone information is included in returned ServiceState:

- Service state: IN_SERVICE, OUT_OF_SERVICE, EMERGENCY_ONLY, POWER_OFF
- Duplex mode: UNKNOWN, FDD, TDD
- Roaming indicator
- Operator name, short name and numeric id
- Network selection mode

For historical reasons this class is not declared as final; however, it should be treated as though it were final.

<br />

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/telephony/ServiceState#DUPLEX_MODE_FDD` Duplex mode for the phone is frequency-division duplexing. |
| `int` | `https://developer.android.com/reference/android/telephony/ServiceState#DUPLEX_MODE_TDD` Duplex mode for the phone is time-division duplexing. |
| `int` | `https://developer.android.com/reference/android/telephony/ServiceState#DUPLEX_MODE_UNKNOWN` Duplex mode for the phone is unknown. |
| `int` | `https://developer.android.com/reference/android/telephony/ServiceState#STATE_EMERGENCY_ONLY` The phone is registered and locked. Only emergency numbers are allowed. |
| `int` | `https://developer.android.com/reference/android/telephony/ServiceState#STATE_IN_SERVICE` Normal operation condition, the phone is registered with an operator either in home network or in roaming. |
| `int` | `https://developer.android.com/reference/android/telephony/ServiceState#STATE_OUT_OF_SERVICE` Phone is not registered with any operator, the phone can be currently searching a new operator to register to, or not searching to registration at all, or registration is denied, or radio signal is not available. |
| `int` | `https://developer.android.com/reference/android/telephony/ServiceState#STATE_POWER_OFF` Radio of telephony is explicitly powered off. |
| `int` | `https://developer.android.com/reference/android/telephony/ServiceState#UNKNOWN_ID` Unknown ID. |

### Inherited constants

From interface `https://developer.android.com/reference/android/os/Parcelable` `int` `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR`

Descriptor bit used with `https://developer.android.com/reference/android/os/Parcelable#describeContents()`: indicates that the Parcelable object's flattened representation includes a file descriptor.
`int` `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`

Flag for use with `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`: the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`".

| ### Fields ||
|---|---|
| ` public static final https://developer.android.com/reference/android/os/Parcelable.Creator<https://developer.android.com/reference/android/telephony/ServiceState>` | `https://developer.android.com/reference/android/telephony/ServiceState#CREATOR` <br /> |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/telephony/ServiceState#ServiceState()() ` Empty constructor |
| ` https://developer.android.com/reference/android/telephony/ServiceState#ServiceState(android.os.Parcel)(https://developer.android.com/reference/android/os/Parcel in) ` *This constructor is deprecated. The constructor takes parcel should not be public at the beginning. Use `https://developer.android.com/reference/android/telephony/ServiceState#ServiceState()` instead.* |
| ` https://developer.android.com/reference/android/telephony/ServiceState#ServiceState(android.telephony.ServiceState)(https://developer.android.com/reference/android/telephony/ServiceState s) ` Copy constructors |

| ### Public methods ||
|---|---|
| ` int` | ` https://developer.android.com/reference/android/telephony/ServiceState#describeContents()() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
| ` boolean` | ` https://developer.android.com/reference/android/telephony/ServiceState#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) ` Indicates whether some other object is "equal to" this one. |
| ` int` | ` https://developer.android.com/reference/android/telephony/ServiceState#getCdmaNetworkId()() ` Get the CDMA NID (Network Identification Number), a number uniquely identifying a network within a wireless system. |
| ` int` | ` https://developer.android.com/reference/android/telephony/ServiceState#getCdmaSystemId()() ` Get the CDMA SID (System Identification Number), a number uniquely identifying a wireless system. |
| ` int[]` | ` https://developer.android.com/reference/android/telephony/ServiceState#getCellBandwidths()() ` Get an array of cell bandwidths (kHz) for the current serving cells |
| ` int` | ` https://developer.android.com/reference/android/telephony/ServiceState#getChannelNumber()() ` Get the channel number of the current primary serving cell, or -1 if unknown This is NRARFCN for NR, EARFCN for LTE, UARFCN for UMTS, and ARFCN for GSM. |
| ` int` | ` https://developer.android.com/reference/android/telephony/ServiceState#getDuplexMode()() ` Get the current duplex mode |
| ` boolean` | ` https://developer.android.com/reference/android/telephony/ServiceState#getIsManualSelection()() ` Get current network selection mode. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/telephony/NetworkRegistrationInfo>` | ` https://developer.android.com/reference/android/telephony/ServiceState#getNetworkRegistrationInfoList()() ` Get all of the available network registration info. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/telephony/ServiceState#getOperatorAlphaLong()() ` Get current registered operator name in long alphanumeric format. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/telephony/ServiceState#getOperatorAlphaShort()() ` Get current registered operator name in short alphanumeric format. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/telephony/ServiceState#getOperatorNumeric()() ` Get current registered operator numeric id. |
| ` boolean` | ` https://developer.android.com/reference/android/telephony/ServiceState#getRoaming()() ` Get current roaming indicator of phone. |
| ` int` | ` https://developer.android.com/reference/android/telephony/ServiceState#getState()() ` Get current voice service state |
| ` int` | ` https://developer.android.com/reference/android/telephony/ServiceState#hashCode()() ` Returns a hash code value for the object. |
| ` boolean` | ` https://developer.android.com/reference/android/telephony/ServiceState#isSearching()() ` This indicates whether the device is searching for service. |
| ` boolean` | ` https://developer.android.com/reference/android/telephony/ServiceState#isUsingNonTerrestrialNetwork()() ` Get whether device is connected to a non-terrestrial network. |
| ` void` | ` https://developer.android.com/reference/android/telephony/ServiceState#setIsManualSelection(boolean)(boolean isManual) ` |
| ` void` | ` https://developer.android.com/reference/android/telephony/ServiceState#setOperatorName(java.lang.String,%20java.lang.String,%20java.lang.String)(https://developer.android.com/reference/java/lang/String longName, https://developer.android.com/reference/java/lang/String shortName, https://developer.android.com/reference/java/lang/String numeric) ` |
| ` void` | ` https://developer.android.com/reference/android/telephony/ServiceState#setRoaming(boolean)(boolean roaming) ` |
| ` void` | ` https://developer.android.com/reference/android/telephony/ServiceState#setState(int)(int state) ` |
| ` void` | ` https://developer.android.com/reference/android/telephony/ServiceState#setStateOff()() ` |
| ` void` | ` https://developer.android.com/reference/android/telephony/ServiceState#setStateOutOfService()() ` |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/telephony/ServiceState#toString()() ` Returns a string representation of the object. |
| ` void` | ` https://developer.android.com/reference/android/telephony/ServiceState#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel out, int flags) ` Flatten this object in to a Parcel. |

| ### Protected methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/telephony/ServiceState#copyFrom(android.telephony.ServiceState)(https://developer.android.com/reference/android/telephony/ServiceState s) ` |

### 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*.
From interface ` https://developer.android.com/reference/android/os/Parcelable ` ` abstract int` ` https://developer.android.com/reference/android/os/Parcelable#describeContents()() `

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.
` abstract void` ` https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags) `

Flatten this object in to a Parcel.

## Constants

### DUPLEX_MODE_FDD

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

```
public static final int DUPLEX_MODE_FDD
```

Duplex mode for the phone is frequency-division duplexing.

<br />

Constant Value: 1 (0x00000001)

### DUPLEX_MODE_TDD

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

```
public static final int DUPLEX_MODE_TDD
```

Duplex mode for the phone is time-division duplexing.

<br />

Constant Value: 2 (0x00000002)

### DUPLEX_MODE_UNKNOWN

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

```
public static final int DUPLEX_MODE_UNKNOWN
```

Duplex mode for the phone is unknown.

<br />

Constant Value: 0 (0x00000000)

### STATE_EMERGENCY_ONLY

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

```
public static final int STATE_EMERGENCY_ONLY
```

The phone is registered and locked. Only emergency numbers are allowed.

<br />

<br />

Constant Value: 2 (0x00000002)

### STATE_IN_SERVICE

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

```
public static final int STATE_IN_SERVICE
```

Normal operation condition, the phone is registered with an operator either in home network or in roaming.

<br />

Constant Value: 0 (0x00000000)

### STATE_OUT_OF_SERVICE

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

```
public static final int STATE_OUT_OF_SERVICE
```

Phone is not registered with any operator, the phone can be currently searching a new operator to register to, or not searching to registration at all, or registration is denied, or radio signal is not available.

<br />

Constant Value: 1 (0x00000001)

### STATE_POWER_OFF

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

```
public static final int STATE_POWER_OFF
```

Radio of telephony is explicitly powered off.

<br />

Constant Value: 3 (0x00000003)

### UNKNOWN_ID

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

```
public static final int UNKNOWN_ID
```

Unknown ID. Could be returned by `https://developer.android.com/reference/android/telephony/ServiceState#getCdmaNetworkId()` or `https://developer.android.com/reference/android/telephony/ServiceState#getCdmaSystemId()`

<br />

Constant Value: -1 (0xffffffff)

## Fields

### CREATOR

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

```
public static final Creator<ServiceState> CREATOR
```

<br />

<br />

## Public constructors

### ServiceState

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

```
public ServiceState ()
```

Empty constructor

<br />

### ServiceState

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

```
public ServiceState (Parcel in)
```

<br />

**This constructor is deprecated.**   

The constructor takes parcel should not be public at the beginning. Use `https://developer.android.com/reference/android/telephony/ServiceState#ServiceState()` instead.

Construct a ServiceState object from the given parcel.

<br />

| Parameters ||
|---|---|
| `in` | `Parcel` <br /> |

### ServiceState

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

```
public ServiceState (ServiceState s)
```

Copy constructors

<br />

| Parameters ||
|---|---|
| `s` | `ServiceState`: Source service state <br /> |

## Public methods

### describeContents

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

```
public int describeContents ()
```

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`, the return value of this method must include the `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` bit.

<br />

| Returns ||
|---|---|
| `int` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either `0` or - `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` |

### equals

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

```
public boolean equals (Object o)
```

Indicates whether some other object is "equal to" this one.

The `equals` method implements an equivalence relation on non-null object references:

- It is *reflexive*: for any non-null reference value `x`, `x.equals(x)` should return `true`.
- It is *symmetric*: for any non-null reference values `x` and `y`, `x.equals(y)` should return `true` if and only if `y.equals(x)` returns `true`.
- It is *transitive*: for any non-null reference values `x`, `y`, and `z`, if `x.equals(y)` returns `true` and `y.equals(z)` returns `true`, then `x.equals(z)` should return `true`.
- It is *consistent*: for any non-null reference values `x` and `y`, multiple invocations of `x.equals(y)` consistently return `true` or consistently return `false`, provided no information used in `equals` comparisons on the objects is modified.
- For any non-null reference value `x`, `x.equals(null)` should return `false`.

An equivalence relation partitions the elements it operates on into *equivalence classes*; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

<br />

| Parameters ||
|---|---|
| `o` | `Object`: the reference object with which to compare. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if this object is the same as the obj argument; `false` otherwise. <br /> |

### getCdmaNetworkId

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

```
public int getCdmaNetworkId ()
```

Get the CDMA NID (Network Identification Number), a number uniquely identifying a network within a wireless system. (Defined in 3GPP2 C.S0023 3.4.8)

Require at least `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION`. Otherwise return `https://developer.android.com/reference/android/telephony/ServiceState#UNKNOWN_ID`.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION`

<br />

| Returns ||
|---|---|
| `int` | `https://developer.android.com/reference/android/telephony/ServiceState#UNKNOWN_ID` as CDMA is no longer supported. <br /> |

### getCdmaSystemId

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

```
public int getCdmaSystemId ()
```

Get the CDMA SID (System Identification Number), a number uniquely identifying a wireless system. (Defined in 3GPP2 C.S0023 3.4.8)

Require at least `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION`. Otherwise return `https://developer.android.com/reference/android/telephony/ServiceState#UNKNOWN_ID`.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION`

<br />

| Returns ||
|---|---|
| `int` | `https://developer.android.com/reference/android/telephony/ServiceState#UNKNOWN_ID` as CDMA is no longer supported. <br /> |

### getCellBandwidths

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

```
public int[] getCellBandwidths ()
```

Get an array of cell bandwidths (kHz) for the current serving cells

<br />

| Returns ||
|---|---|
| `int[]` | Current serving cell bandwidths <br /> |

### getChannelNumber

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

```
public int getChannelNumber ()
```

Get the channel number of the current primary serving cell, or -1 if unknown

This is NRARFCN for NR, EARFCN for LTE, UARFCN for UMTS, and ARFCN for GSM.

<br />

| Returns ||
|---|---|
| `int` | Channel number of primary serving cell <br /> |

### getDuplexMode

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

```
public int getDuplexMode ()
```

Get the current duplex mode

<br />

| Returns ||
|---|---|
| `int` | Current `DuplexMode` for the phone. Value is one of the following: - `https://developer.android.com/reference/android/telephony/ServiceState#DUPLEX_MODE_UNKNOWN` - `https://developer.android.com/reference/android/telephony/ServiceState#DUPLEX_MODE_FDD` - `https://developer.android.com/reference/android/telephony/ServiceState#DUPLEX_MODE_TDD` |

**See also:**

- `https://developer.android.com/reference/android/telephony/ServiceState#DUPLEX_MODE_UNKNOWN`
- `https://developer.android.com/reference/android/telephony/ServiceState#DUPLEX_MODE_FDD`
- `https://developer.android.com/reference/android/telephony/ServiceState#DUPLEX_MODE_TDD`

### getIsManualSelection

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

```
public boolean getIsManualSelection ()
```

Get current network selection mode.

<br />

| Returns ||
|---|---|
| `boolean` | true if manual mode, false if automatic mode <br /> |

### getNetworkRegistrationInfoList

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

```
public List<NetworkRegistrationInfo> getNetworkRegistrationInfoList ()
```

Get all of the available network registration info.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/telephony/NetworkRegistrationInfo>` | List of `https://developer.android.com/reference/android/telephony/NetworkRegistrationInfo` This value cannot be `null`. <br /> |

### getOperatorAlphaLong

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

```
public String getOperatorAlphaLong ()
```

Get current registered operator name in long alphanumeric format. In GSM/UMTS, long format can be up to 16 characters long. In CDMA, returns the ERI text, if set. Otherwise, returns the ONS. Require at least `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION`. Otherwise return null if the caller does not hold neither `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION` nor `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION`.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION`

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | long name of operator, null if unregistered or unknown <br /> |

### getOperatorAlphaShort

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

```
public String getOperatorAlphaShort ()
```

Get current registered operator name in short alphanumeric format. In GSM/UMTS, short format can be up to 8 characters long. Require at least `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION`. Otherwise return null if the caller does not hold neither `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION` nor `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION`.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION`

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | short name of operator, null if unregistered or unknown <br /> |

### getOperatorNumeric

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

```
public String getOperatorNumeric ()
```

Get current registered operator numeric id. In GSM/UMTS, numeric format is 3 digit country code plus 2 or 3 digit network code. Require at least `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION`. Otherwise return null if the caller does not hold neither `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION` nor `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION`.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION`

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | numeric format of operator, null if unregistered or unknown <br /> |

### getRoaming

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

```
public boolean getRoaming ()
```

Get current roaming indicator of phone. This roaming state could be overridden by the carrier config. (note: not just decoding from TS 27.007 7.2)

<br />

| Returns ||
|---|---|
| `boolean` | true if TS 27.007 7.2 roaming is true and ONS is different from SPN <br /> |

**See also:**

- `https://developer.android.com/reference/android/telephony/TelephonyDisplayInfo#isRoaming()`
- `https://developer.android.com/reference/android/telephony/CarrierConfigManager#KEY_FORCE_HOME_NETWORK_BOOL`
- `https://developer.android.com/reference/android/telephony/CarrierConfigManager#KEY_GSM_ROAMING_NETWORKS_STRING_ARRAY`
- `https://developer.android.com/reference/android/telephony/CarrierConfigManager#KEY_GSM_NONROAMING_NETWORKS_STRING_ARRAY`
- `https://developer.android.com/reference/android/telephony/CarrierConfigManager#KEY_CDMA_ROAMING_NETWORKS_STRING_ARRAY`
- `https://developer.android.com/reference/android/telephony/CarrierConfigManager#KEY_CDMA_NONROAMING_NETWORKS_STRING_ARRAY`

### getState

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

```
public int getState ()
```

Get current voice service state

<br />

| Returns ||
|---|---|
| `int` | <br /> |

### hashCode

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

```
public int hashCode ()
```

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by `https://developer.android.com/reference/java/util/HashMap`.

The general contract of `hashCode` is:

- Whenever it is invoked on the same object more than once during an execution of a Java application, the `hashCode` method must consistently return the same integer, provided no information used in `equals` comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
- If two objects are equal according to the `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)` method, then calling the `hashCode` method on each of the two objects must produce the same integer result.
- It is *not* required that if two objects are unequal according to the `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)` method, then calling the `hashCode` method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

<br />

<br />

| Returns ||
|---|---|
| `int` | a hash code value for this object. <br /> |

### isSearching

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

```
public boolean isSearching ()
```

This indicates whether the device is searching for service. This API reports the modem searching status for `https://developer.android.com/reference/android/telephony/AccessNetworkConstants#TRANSPORT_TYPE_WWAN` (cellular) service in either `https://developer.android.com/reference/android/telephony/NetworkRegistrationInfo#DOMAIN_CS` or `https://developer.android.com/reference/android/telephony/NetworkRegistrationInfo#DOMAIN_PS`. This API will not report searching status for `https://developer.android.com/reference/android/telephony/AccessNetworkConstants#TRANSPORT_TYPE_WLAN`.

<br />

| Returns ||
|---|---|
| `boolean` | `true` whenever the modem is searching for service. <br /> |

### isUsingNonTerrestrialNetwork

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

```
public boolean isUsingNonTerrestrialNetwork ()
```

Get whether device is connected to a non-terrestrial network.

<br />

| Returns ||
|---|---|
| `boolean` | `true` if device is connected to a non-terrestrial network else `false`. <br /> |

### setIsManualSelection

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

```
public void setIsManualSelection (boolean isManual)
```

<br />

<br />

| Parameters ||
|---|---|
| `isManual` | `boolean` <br /> |

### setOperatorName

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

```
public void setOperatorName (String longName, 
                String shortName, 
                String numeric)
```

<br />

<br />

| Parameters ||
|---|---|
| `longName` | `String` <br /> |
| `shortName` | `String` <br /> |
| `numeric` | `String` <br /> |

### setRoaming

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

```
public void setRoaming (boolean roaming)
```

<br />

<br />

| Parameters ||
|---|---|
| `roaming` | `boolean` <br /> |

### setState

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

```
public void setState (int state)
```

<br />

<br />

| Parameters ||
|---|---|
| `state` | `int` <br /> |

### setStateOff

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

```
public void setStateOff ()
```

<br />

<br />

### setStateOutOfService

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

```
public void setStateOutOfService ()
```

<br />

<br />

### toString

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

```
public String toString ()
```

Returns a string representation of the object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | a string representation of the object. <br /> |

### writeToParcel

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

```
public void writeToParcel (Parcel out, 
                int flags)
```

Flatten this object in to a Parcel.

<br />

| Parameters ||
|---|---|
| `out` | `Parcel`: The Parcel in which the object should be written. This value cannot be `null`. <br /> |
| `flags` | `int`: Additional flags about how the object should be written. May be 0 or `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE` |

## Protected methods

### copyFrom

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

```
protected void copyFrom (ServiceState s)
```

<br />

<br />

| Parameters ||
|---|---|
| `s` | `ServiceState` <br /> |