public static boolean isMultiSim(Context context){
boolean result = false;
TelecomManager telecomManager = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
if(telecomManager != null){
List<PhoneAccountHandle> phoneAccountHandleList = telecomManager.getCallCapablePhoneAccounts();
result = phoneAccountHandleList.size() >= 2;
}
return result;
}
获取sim数量
public static void call(Context context, int id, String telNum){
TelecomManager telecomManager = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
if(telecomManager != null){
List<PhoneAccountHandle> phoneAccountHandleList = telecomManager.getCallCapablePhoneAccounts();
Intent intent = new Intent();
intent.setAction(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:" + telNum));
intent.putExtra(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE, phoneAccountHandleList.get(id));
context.startActivity(intent);
}
}
用指定sim卡拨号
之后还需要自己去完善,之前使用的时候发现了6.0运行时权限的问题