1>获得TelephonyManager
TelephonyManager telMgr = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
2>获取SIM卡状态
telMgr.getSimState();
3>获取SIM卡卡号
telMgr.getSimSerialNumber();
4>获取SIM卡供货商号
telMgr.getSimOperator();
5>获取SIM卡供货商名称
telMgr.getSimOperatorName();
6>获取SIM卡国别
telMgr.getSimCountryIso();
7>获取手机类型
telMgr.getPhoneType();
8>获取网络类型
telMgr.getNetworkType();
9>获取网络供应商号
telMgr.getNetworkOperator();
10>获取网络供应商名称
telMgr.getNetworkOperatorName();
11>获得手机号码
telMgr.getLine1Number();
//漫游状态
telMgr.isNetworkRoaming();
//IMEI
telMgr.getDeviceSoftwareVersion();
//IMSI
telMgr.getSubscriberId();
ContentResolver cv = SampleActivity20.this.getContentResolver();
String tmpS = "";
//蓝牙是否开启
tmpS = android.provider.Settings.System.getString(cv,android.provider.Settings.System.BLUETOOTH_ON);
//WIFI是否开启
tmpS = android.provider.Settings.System.getString(cv,android.provider.Settings.System.WIFI_ON);
//飞行模式是否开启
tmpS = android.provider.Settings.System.getString(cv,android.provider.Settings.System.AIRPLANE_MODE_ON);
//数据漫游是否开启
tmpS = android.provider.Settings.System.getString(cv,android.provider.Settings.System.DATA_ROAMING);
| int | getCallState()
Returns a constant indicating the call state (cellular) on the device.
|
| CellLocation | getCellLocation()
Returns the current location of the device.
|
| int | getDataActivity()
Returns a constant indicating the type of activity on a data connection (cellular).
|
| int | getDataState()
Returns a constant indicating the current data connection state (cellular).
|
| String | getDeviceId()
Returns the unique device ID, for example, the IMEI for GSM and the MEID or ESN for CDMA phones.
|
| String | getDeviceSoftwareVersion()
Returns the software version number for the device, for example, the IMEI/SV for GSM phones.
|
| String | getLine1Number()
Returns the phone number string for line 1, for example, the MSISDN for a GSM phone.
|
| List<NeighboringCellInfo> | getNeighboringCellInfo()
Returns the neighboring cell information of the device.
|
| String | getNetworkCountryIso()
Returns the ISO country code equivalent of the current registered operator's MCC (Mobile Country Code).
|
| String | getNetworkOperator()
Returns the numeric name (MCC+MNC) of current registered operator.
|
| String | getNetworkOperatorName()
Returns the alphabetic name of current registered operator.
|
| int | getNetworkType()
Returns a constant indicating the radio technology (network type) currently in use on the device for data transmission.
|
| int | getPhoneType()
Returns a constant indicating the device phone type.
|
| String | getSimCountryIso()
Returns the ISO country code equivalent for the SIM provider's country code.
|
| String | getSimOperator()
Returns the MCC+MNC (mobile country code + mobile network code) of the provider of the SIM.
|
| String | getSimOperatorName()
Returns the Service Provider Name (SPN).
|
| String | getSimSerialNumber()
Returns the serial number of the SIM, if applicable.
|
| int | getSimState()
Returns a constant indicating the state of the device SIM card.
|
| String | getSubscriberId()
Returns the unique subscriber ID, for example, the IMSI for a GSM phone.
|
| String | getVoiceMailAlphaTag()
Retrieves the alphabetic identifier associated with the voice mail number.
|
| String | getVoiceMailNumber()
Returns the voice mail number.
|
| boolean | hasIccCard() |
| boolean | isNetworkRoaming()
Returns true if the device is considered roaming on the current network, for GSM purposes.
|
| void | listen(PhoneStateListener listener, int events)
Registers a listener object to receive notification of changes in specified telephony states.
|
本文介绍如何使用Android系统API获取设备的详细信息,包括SIM卡状态、运营商信息、网络类型等,并展示了如何检查蓝牙、WIFI及飞行模式的状态。
882

被折叠的 条评论
为什么被折叠?



