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 | |
open Boolean | |
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() |
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() |
open Unit | writeToParcel(out: Parcel, flags: Int) |
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: 1
DUPLEX_MODE_TDD
static val DUPLEX_MODE_TDD: Int
Duplex mode for the phone is time-division duplexing.
Value: 2
DUPLEX_MODE_UNKNOWN
static val DUPLEX_MODE_UNKNOWN: Int
Duplex mode for the phone is unknown.
Value: 0
STATE_EMERGENCY_ONLY
static val STATE_EMERGENCY_ONLY: Int
The phone is registered and locked. Only emergency numbers are allowed. {@more}
Value: 2
STATE_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: 0
STATE_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: 1
STATE_POWER_OFF
static val STATE_POWER_OFF: Int
Radio of telephony is explicitly powered off.
Value: 3
UNKNOWN_ID
static val UNKNOWN_ID: Int
Unknown ID. Could be returned by getCdmaNetworkId()
or getCdmaSystemId()
Value: -1
Public 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
Return | |
---|---|
Int | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR |
equals
open fun equals(other: Any?): Boolean
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 android.telephony.ServiceState#DUPLEX_MODE_UNKNOWN , android.telephony.ServiceState#DUPLEX_MODE_FDD , or android.telephony.ServiceState#DUPLEX_MODE_TDD |
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_BOOL
android.telephony.CarrierConfigManager#KEY_GSM_ROAMING_NETWORKS_STRING_ARRAY
android.telephony.CarrierConfigManager#KEY_GSM_NONROAMING_NETWORKS_STRING_ARRAY
android.telephony.CarrierConfigManager#KEY_CDMA_ROAMING_NETWORKS_STRING_ARRAY
android.telephony.CarrierConfigManager#KEY_CDMA_NONROAMING_NETWORKS_STRING_ARRAY
hashCode
open fun hashCode(): Int
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
Return | |
---|---|
String | a string representation of the object. |
writeToParcel
open fun writeToParcel(
out: Parcel,
flags: Int
): Unit
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 android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE , and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |