Android
android.telephony
public class

android.telephony.ServiceState

java.lang.Object
android.telephony.ServiceState Parcelable

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
  • Roaming indicator
  • Operator name, short name and numeric id
  • Network selection mode

Summary

Constants

      Value  
Creator<ServiceState CREATOR       
int  STATE_EMERGENCY_ONLY  The phone is registered and locked. Only emergency numbers are allowed.   0x00000002 
int  STATE_IN_SERVICE  Normal operation condition, the phone is registered with an operator either in home network or in roaming.  0x00000000 
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.  0x00000001 
int  STATE_POWER_OFF  Radio of telephony is explictly powered off.  0x00000003 
Constants inherited from interface android.os.Parcelable

Public Constructors

            ServiceState()
Empty constructor
            ServiceState(ServiceState s)
Copy constructors
            ServiceState(Parcel in)
Construct a ServiceState object from the given parcel.

Public Methods

          int  describeContents()
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
          boolean  equals(Object o)
Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
          boolean  getIsManualSelection()
Get current network selection mode
          String  getOperatorAlphaLong()
Get current registered operator name in long alphanumeric format In GSM/UMTS, long format can be upto 16 characters long
          String  getOperatorAlphaShort()
Get current registered operator name in short lphanumeric format In GSM/UMST, short format can be upto 8 characters long
          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 The country code can be decoded using MccTable.countryCodeForMcc()
          boolean  getRoaming()
Get current roaming indicator of phone (note: not just decoding from TS 27.007 7.2)
          int  getState()
Get current servcie state of phone
          int  hashCode()
Returns an integer hash code for the receiver.
          void  setIsManualSelection(boolean isManual)
          void  setOperatorName(String longName, String shortName, String numeric)
          void  setRoaming(boolean roaming)
          void  setState(int state)
          void  setStateOff()
          void  setStateOutOfService()
          String  toString()
Returns a string containing a concise, human-readable description of the receiver.
          void  writeToParcel(Parcel out, int flags)
Flatten this object in to a Parcel.

Protected Methods

          void  copyFrom(ServiceState s)
Methods inherited from class java.lang.Object
Methods inherited from interface android.os.Parcelable

Details

Constants

public static final Creator<ServiceState> CREATOR

public static final int STATE_EMERGENCY_ONLY

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

Constant Value: 2 (0x00000002)

public static final int STATE_IN_SERVICE

Normal operation condition, the phone is registered with an operator either in home network or in roaming.
Constant Value: 0 (0x00000000)

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.
Constant Value: 1 (0x00000001)

public static final int STATE_POWER_OFF

Radio of telephony is explictly powered off.
Constant Value: 3 (0x00000003)

Public Constructors

public ServiceState()

Empty constructor

public ServiceState(ServiceState s)

Copy constructors

Parameters

s Source service state

public ServiceState(Parcel in)

Construct a ServiceState object from the given parcel.

Public Methods

public int describeContents()

Describe the kinds of special objects contained in this Parcelable's marshalled representation.

public boolean equals(Object o)

Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison. The implementation in Object returns true only if the argument is the exact same object as the receiver (==).

Parameters

o Object the object to compare with this object.

Returns

  • boolean true if the object is the same as this object false if it is different from this object.

public boolean getIsManualSelection()

Get current network selection mode

Returns

  • true if manual mode, false if automatic mode

public String getOperatorAlphaLong()

Get current registered operator name in long alphanumeric format In GSM/UMTS, long format can be upto 16 characters long

Returns

  • long name of operator, null if unregistered or unknown

public String getOperatorAlphaShort()

Get current registered operator name in short lphanumeric format In GSM/UMST, short format can be upto 8 characters long

Returns

  • short name of operator, null if unregistered or unknown

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 The country code can be decoded using MccTable.countryCodeForMcc()

Returns

  • numeric format of operator, null if unregistered or unknown

public boolean getRoaming()

Get current roaming indicator of phone (note: not just decoding from TS 27.007 7.2)

Returns

  • true if TS 27.007 7.2 roaming is true and ONS is different from SPN

public int getState()

Get current servcie state of phone

public int hashCode()

Returns an integer hash code for the receiver. Any two objects which answer true when passed to .equals must answer the same value for this method.

Returns

  • int the receiver's hash.

public void setIsManualSelection(boolean isManual)

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

public void setRoaming(boolean roaming)

public void setState(int state)

public void setStateOff()

public void setStateOutOfService()

public String toString()

Returns a string containing a concise, human-readable description of the receiver.

Returns

  • String a printable representation for the receiver.

public void writeToParcel(Parcel out, int flags)

Flatten this object in to a Parcel.

Protected Methods

protected void copyFrom(ServiceState s)

Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:48