TelephonyManager电话网络信息的服务类




TelephonyManager是一个管理手机通话状态,电话网络信息的服务类




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.

 

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

chenzhiyuan09

你的鼓励是我最大的动力一起加吧

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值