ServiceState
open class ServiceState : Parcelable
| kotlin.Any | |
| ↳ | android.telephony.ServiceState |
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
Summary
| Constants | |
|---|---|
| static Int |
Duplex mode for the phone is frequency-division duplexing. |
| static Int |
Duplex mode for the phone is time-division duplexing. |
| static Int |
Duplex mode for the phone is unknown. |
| static Int |
The phone is registered and locked. |
| static Int |
Normal operation condition, the phone is registered with an operator either in home network or in roaming. |
| static Int |
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. |
| static Int |
Radio of telephony is explicitly powered off. |
| static Int |
Unknown ID. |
| Inherited constants | |
|---|---|
| Public constructors | |
|---|---|
|
Empty constructor |
|
ServiceState(in: Parcel!)Construct a ServiceState object from the given parcel. |
|
ServiceState(s: ServiceState!)Copy constructors |
|
| Public methods | |
|---|---|
| open Int |
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
| open Boolean |
Indicates whether some other object is "equal to" this one. |
| open Int |
Get the CDMA NID (Network Identification Number), a number uniquely identifying a network within a wireless system. |
| open Int |
Get the CDMA SID (System Identification Number), a number uniquely identifying a wireless system. |
| open IntArray! |
Get an array of cell bandwidths (kHz) for the current serving cells |
| open Int |
Get the channel number of the current primary serving cell, or -1 if unknown |
| open Int |
Get the current duplex mode |
| open Boolean |
Get current network selection mode. |
| open MutableList<NetworkRegistrationInfo!> |
Get all of the available network registration info. |
| open String! |
Get current registered operator name in long alphanumeric format. |
| open String! |
Get current registered operator name in short alphanumeric format. |
| open String! |
Get current registered operator numeric id. |
| open Boolean |
Get current roaming indicator of phone. |
| open Int |
getState()Get current voice service state |
| open Int |
hashCode()Returns a hash code value for the object. |
| open Boolean |
This indicates whether the device is searching for service. |
| open Boolean |
Get whether device is connected to a non-terrestrial network. |
| open Unit |
setIsManualSelection(isManual: Boolean) |
| open Unit |
setOperatorName(longName: String!, shortName: String!, numeric: String!) |
| open Unit |
setRoaming(roaming: Boolean) |
| open Unit | |
| open Unit | |
| open Unit | |
| open String |
toString()Returns a string representation of the object. |
| open Unit |
writeToParcel(out: Parcel, flags: Int)Flatten this object in to a Parcel. |
| Protected methods | |
|---|---|
| open Unit |
copyFrom(s: ServiceState!) |
| Properties | |
|---|---|
| static Parcelable.Creator<ServiceState!> | |
Constants
DUPLEX_MODE_FDD
static val DUPLEX_MODE_FDD: Int
Duplex mode for the phone is frequency-division duplexing.
Value: 1DUPLEX_MODE_TDD
static val DUPLEX_MODE_TDD: Int
Duplex mode for the phone is time-division duplexing.
Value: 2DUPLEX_MODE_UNKNOWN
static val DUPLEX_MODE_UNKNOWN: Int
Duplex mode for the phone is unknown.
Value: 0STATE_EMERGENCY_ONLY
static val STATE_EMERGENCY_ONLY: Int
The phone is registered and locked. Only emergency numbers are allowed. {@more}
Value: 2STATE_IN_SERVICE
static val STATE_IN_SERVICE: Int
Normal operation condition, the phone is registered with an operator either in home network or in roaming.
Value: 0STATE_OUT_OF_SERVICE
static val STATE_OUT_OF_SERVICE: Int
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.
Value: 1STATE_POWER_OFF
static val STATE_POWER_OFF: Int
Radio of telephony is explicitly powered off.
Value: 3UNKNOWN_ID
static val UNKNOWN_ID: Int
Unknown ID. Could be returned by getCdmaNetworkId() or getCdmaSystemId()
Value: -1Public constructors
ServiceState
ServiceState(in: Parcel!)
Deprecated: The constructor takes parcel should not be public at the beginning. Use ServiceState() instead.
Construct a ServiceState object from the given parcel.
ServiceState
ServiceState(s: ServiceState!)
Copy constructors
| Parameters | |
|---|---|
s |
ServiceState!: Source service state |
Public methods
describeContents
open fun describeContents(): Int
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 writeToParcel(android.os.Parcel,int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.
| Return | |
|---|---|
Int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or
|
equals
open fun equals(other: Any?): Boolean
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 returntrue. - It is symmetric: for any non-null reference values
xandy,x.equals(y)should returntrueif and only ify.equals(x)returnstrue. - It is transitive: for any non-null reference values
x,y, andz, ifx.equals(y)returnstrueandy.equals(z)returnstrue, thenx.equals(z)should returntrue. - It is consistent: for any non-null reference values
xandy, multiple invocations ofx.equals(y)consistently returntrueor consistently returnfalse, provided no information used inequalscomparisons on the objects is modified. - For any non-null reference value
x,x.equals(null)should returnfalse.
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.
| Parameters | |
|---|---|
obj |
the reference object with which to compare. |
| Return | |
|---|---|
Boolean |
true if this object is the same as the obj argument; false otherwise. |
getCdmaNetworkId
open fun getCdmaNetworkId(): Int
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 android.Manifest.permission#ACCESS_FINE_LOCATION or android.Manifest.permission#ACCESS_COARSE_LOCATION. Otherwise return UNKNOWN_ID.
Requires android.Manifest.permission#ACCESS_FINE_LOCATION or android.Manifest.permission#ACCESS_COARSE_LOCATION
| Return | |
|---|---|
Int |
UNKNOWN_ID as CDMA is no longer supported. |
getCdmaSystemId
open fun getCdmaSystemId(): Int
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 android.Manifest.permission#ACCESS_FINE_LOCATION or android.Manifest.permission#ACCESS_COARSE_LOCATION. Otherwise return UNKNOWN_ID.
Requires android.Manifest.permission#ACCESS_FINE_LOCATION or android.Manifest.permission#ACCESS_COARSE_LOCATION
| Return | |
|---|---|
Int |
UNKNOWN_ID as CDMA is no longer supported. |
getCellBandwidths
open fun getCellBandwidths(): IntArray!
Get an array of cell bandwidths (kHz) for the current serving cells
| Return | |
|---|---|
IntArray! |
Current serving cell bandwidths |
getChannelNumber
open fun getChannelNumber(): Int
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.
| Return | |
|---|---|
Int |
Channel number of primary serving cell |
getDuplexMode
open fun getDuplexMode(): Int
Get the current duplex mode
| Return | |
|---|---|
Int |
Current DuplexMode for the phone. Value is one of the following: |
getIsManualSelection
open fun getIsManualSelection(): Boolean
Get current network selection mode.
| Return | |
|---|---|
Boolean |
true if manual mode, false if automatic mode |
getNetworkRegistrationInfoList
open fun getNetworkRegistrationInfoList(): MutableList<NetworkRegistrationInfo!>
Get all of the available network registration info.
| Return | |
|---|---|
MutableList<NetworkRegistrationInfo!> |
List of NetworkRegistrationInfo This value cannot be null. |
getOperatorAlphaLong
open fun getOperatorAlphaLong(): String!
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 android.Manifest.permission#ACCESS_FINE_LOCATION or android.Manifest.permission#ACCESS_COARSE_LOCATION. Otherwise return null if the caller does not hold neither android.Manifest.permission#ACCESS_FINE_LOCATION nor android.Manifest.permission#ACCESS_COARSE_LOCATION.
Requires android.Manifest.permission#ACCESS_FINE_LOCATION or android.Manifest.permission#ACCESS_COARSE_LOCATION
| Return | |
|---|---|
String! |
long name of operator, null if unregistered or unknown |
getOperatorAlphaShort
open fun getOperatorAlphaShort(): String!
Get current registered operator name in short alphanumeric format. In GSM/UMTS, short format can be up to 8 characters long. Require at least android.Manifest.permission#ACCESS_FINE_LOCATION or android.Manifest.permission#ACCESS_COARSE_LOCATION. Otherwise return null if the caller does not hold neither android.Manifest.permission#ACCESS_FINE_LOCATION nor android.Manifest.permission#ACCESS_COARSE_LOCATION.
Requires android.Manifest.permission#ACCESS_FINE_LOCATION or android.Manifest.permission#ACCESS_COARSE_LOCATION
| Return | |
|---|---|
String! |
short name of operator, null if unregistered or unknown |
getOperatorNumeric
open fun getOperatorNumeric(): String!
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 android.Manifest.permission#ACCESS_FINE_LOCATION or android.Manifest.permission#ACCESS_COARSE_LOCATION. Otherwise return null if the caller does not hold neither android.Manifest.permission#ACCESS_FINE_LOCATION nor android.Manifest.permission#ACCESS_COARSE_LOCATION.
Requires android.Manifest.permission#ACCESS_FINE_LOCATION or android.Manifest.permission#ACCESS_COARSE_LOCATION
| Return | |
|---|---|
String! |
numeric format of operator, null if unregistered or unknown |
getRoaming
open fun getRoaming(): Boolean
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)
| Return | |
|---|---|
Boolean |
true if TS 27.007 7.2 roaming is true and ONS is different from SPN |
See Also
android.telephony.TelephonyDisplayInfo#isRoaming()android.telephony.CarrierConfigManager#KEY_FORCE_HOME_NETWORK_BOOLandroid.telephony.CarrierConfigManager#KEY_GSM_ROAMING_NETWORKS_STRING_ARRAYandroid.telephony.CarrierConfigManager#KEY_GSM_NONROAMING_NETWORKS_STRING_ARRAYandroid.telephony.CarrierConfigManager#KEY_CDMA_ROAMING_NETWORKS_STRING_ARRAYandroid.telephony.CarrierConfigManager#KEY_CDMA_NONROAMING_NETWORKS_STRING_ARRAY
hashCode
open fun hashCode(): Int
Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by 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
hashCodemethod must consistently return the same integer, provided no information used inequalscomparisons 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
equalsmethod, then calling thehashCodemethod 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
equalsmethod, then calling thehashCodemethod 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.
| Return | |
|---|---|
Int |
a hash code value for this object. |
isSearching
open fun isSearching(): Boolean
This indicates whether the device is searching for service. This API reports the modem searching status for AccessNetworkConstants.TRANSPORT_TYPE_WWAN (cellular) service in either NetworkRegistrationInfo.DOMAIN_CS or NetworkRegistrationInfo.DOMAIN_PS. This API will not report searching status for AccessNetworkConstants.TRANSPORT_TYPE_WLAN.
| Return | |
|---|---|
Boolean |
true whenever the modem is searching for service. |
isUsingNonTerrestrialNetwork
open fun isUsingNonTerrestrialNetwork(): Boolean
Get whether device is connected to a non-terrestrial network.
| Return | |
|---|---|
Boolean |
true if device is connected to a non-terrestrial network else false. |
setOperatorName
open fun setOperatorName(
longName: String!,
shortName: String!,
numeric: String!
): Unit
toString
open fun toString(): String
Returns a string representation of the object.
| Return | |
|---|---|
String |
a string representation of the object. |
writeToParcel
open fun writeToParcel(
out: Parcel,
flags: Int
): Unit
Flatten this object in to a Parcel.
| Parameters | |
|---|---|
dest |
The Parcel in which the object should be written. This value cannot be null. |
flags |
Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of the following:
|