android.telephony.TelephonyManager
Access the state of the phone radio.
Summary
Constants
Public Methods
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Constants
public
static
final
int
CALL_STATE_IDLE
Constant Value:
0
(0x00000000)
public
static
final
int
CALL_STATE_OFFHOOK
Constant Value:
2
(0x00000002)
public
static
final
int
CALL_STATE_RINGING
Constant Value:
1
(0x00000001)
public
static
final
int
DATA_ACTIVITY_IN
Constant Value:
1
(0x00000001)
public
static
final
int
DATA_ACTIVITY_INOUT
Constant Value:
3
(0x00000003)
public
static
final
int
DATA_ACTIVITY_NONE
Constant Value:
0
(0x00000000)
public
static
final
int
DATA_ACTIVITY_OUT
Constant Value:
2
(0x00000002)
public
static
final
int
DATA_CONNECTED
Constant Value:
2
(0x00000002)
public
static
final
int
DATA_CONNECTING
Constant Value:
1
(0x00000001)
public
static
final
int
DATA_DISCONNECTED
Constant Value:
0
(0x00000000)
public
static
final
int
DATA_SUSPENDED
Constant Value:
3
(0x00000003)
public
static
final
int
NETWORK_TYPE_EDGE
Constant Value:
2
(0x00000002)
public
static
final
int
NETWORK_TYPE_GPRS
Constant Value:
1
(0x00000001)
public
static
final
int
NETWORK_TYPE_UMTS
Constant Value:
3
(0x00000003)
public
static
final
int
NETWORK_TYPE_UNKNOWN
Constant Value:
0
(0x00000000)
public
static
final
int
PHONE_TYPE_GSM
This is a GSM phone.
Constant Value:
1
(0x00000001)
public
static
final
int
PHONE_TYPE_NONE
This device does not have a phone module.
Constant Value:
0
(0x00000000)
public
static
final
int
SIM_STATE_ABSENT
Constant Value:
1
(0x00000001)
public
static
final
int
SIM_STATE_NETWORK_LOCKED
Constant Value:
4
(0x00000004)
public
static
final
int
SIM_STATE_PIN_REQUIRED
Constant Value:
2
(0x00000002)
public
static
final
int
SIM_STATE_PUK_REQUIRED
Constant Value:
3
(0x00000003)
public
static
final
int
SIM_STATE_READY
Constant Value:
5
(0x00000005)
public
static
final
int
SIM_STATE_UNKNOWN
Constant Value:
0
(0x00000000)
Public Methods
public
int
getCallState()
public
int
getDataActivity()
Get the data activity state.
public
int
getDataState()
public
String
getDeviceId()
Retrieves the unique device ID, e.g., IMEI for GSM phones.
public
String
getDeviceSoftwareVersion()
Retrieves the software version number for the device, e.g., IMEI/SV
for GSM phones.
public
String
getLine1Number()
Retrieves the phone number string for line 1.
public
String
getNetworkCountryIso()
The ISO country code equivilent of the current registered operator's
MCC (Mobile Country Code)
Availability: when registered to a network
public
String
getNetworkOperator()
Numeric name (MCC+MNC) of current registered operator.
Availability: when registered to a network
public
String
getNetworkOperatorName()
Alpha name of current registered operator.
Availability: when registered to a network
public
int
getNetworkType()
Indicates the available radio technology.
public
int
getPhoneType()
public
String
getSimCountryIso()
ISO country code equivalent for the SIM provider's country code
public
String
getSimOperator()
The MCC+MNC (mobile country code+mobile network code) of the
provider of the SIM. 5 or 6 decimal digits.
Availablity: SIM state must be "READY"
public
String
getSimOperatorName()
Also known as the SPN, or Service Provider Name.
Availablity: SIM state must be "READY"
public
String
getSimSerialNumber()
Retrieves the serial number of the SIM, if applicable.
public
int
getSimState()
Returns the state of the SIM.
public
String
getSubscriberId()
Retrieves the unique sbuscriber ID, e.g., IMSI for GSM phones.
public
String
getVoiceMailAlphaTag()
Retrieves the voice mail alpha identifier.
public
String
getVoiceMailNumber()
Retrieves the voice mail number.
public
boolean
isNetworkRoaming()
Returns whether the device is considered roaming on this network for GSM
purposes.
Availability: when registered to a network
public
void
listen(PhoneStateListener listener, int events)
Listen for chagnes in the phone state.
Only changes for the states listeted in the events parameter will be sent. Upon
registration, the callback will be called with the current value.
To stop listening for a given listener, pass PhoneStateListener.LISTEN_NONE (0) as the events argument.