I am wondering about the possibility of making a phone call from android through a selected SIM on a dual SIM android devices. Is it possible to select a particular SIM to call through programmatically?
The Android SDK doesn't provide an APIs to control the SIM being used on dual SIM mobiles. In fact, Android doesn't even really support dual SIM phones. All dual SIM devices are modified extensively by the manufacturers.
You cannot control the SIM through the Android SDK. If any OEM provides such an API for their devices, I am not aware of it, but you can try asking the manufacturer of your dual SIM device directly is such an API exists on their device.
Use ACTION_DIAL to let people select their SIM.
private void callBack(String phone, Context context) {
Intent intent = new Intent(Intent.ACTION_CALL).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//check wheather it is dual sim or not then
//if sim 1
intent.putExtra("simSlot", 0);
//else if sim 2
intent.putExtra("simSlot", 1);
intent.setData(Uri.parse("tel:" + phone));
context.startActivity(intent);
}
Check it is dual sim or not, go through the bellow link
来源:https://stackoverflow.com/questions/14985992/call-through-specified-sim-from-android