双卡双待查sim卡

 

//以下代码适用于判断双卡双待手机,主卡不存在或关闭可查出副卡状态
		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");
		}

你可能感兴趣的:(IM)