双卡双待查sim卡

本文提供了一段用于检测双卡双待手机中主卡及副卡状态的代码示例。通过调用Android系统的ITelephony接口,可以获取到当前激活的电话类型以及无线电台是否开启的状态,以此来判断主卡是否存在或关闭时副卡的工作情况。

 

//以下代码适用于判断双卡双待手机,主卡不存在或关闭可查出副卡状态
		IBinder iBinder = ServiceManager.getService("phone");
		ITelephony iTelephony = ITelephony.Stub.asInterface(iBinder);
		if (iTelephony != null) {
			int acitivePhoneType = -1;
			try {
				acitivePhoneType = iTelephony.getActivePhoneType();
			} catch (RemoteException e) {
				e.printStackTrace();
			}
			Log.d(TAG, "acitivePhoneType:" + acitivePhoneType);
			sb.append(acitivePhoneType).append("  (1:gsm,2:cdma)").append("\n");

			boolean isRadioOn = false;
			try {
				isRadioOn = iTelephony.isRadioOn();
			} catch (RemoteException e) {
				e.printStackTrace();
			}
			Log.d(TAG, "isRadioOn:" + isRadioOn);
			
			sb.append(isRadioOn).append("\n");
		}
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值