我在过去的几天里一直在寻找这个问题,并且我了解到:
“Android中不支持双SIM。这是制造商的定制修改,没有公共API来控制它。”
有一个解决方案提供在下面的链接,但它不能在我的手机三星银河S4迷你。
我也找到了这个链接,我发现了非常有用的信息。
http://www.devlper.com/2010/06/using-android-telephonymanager/
现在我知道了,使用以下代码,我可能有机会幸运地使它正常工作:
Intent callIntent = new Intent(Intent.ACTION_CALL)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
callIntent.setData(Uri.parse("tel:" + phone));
context.startActivity(callIntent);
callIntent.putExtra("com.android.phone.extra.slot", 0); //For sim 1
and
callIntent.putExtra("com.android.phone.extra.slot", 1); //For sim 2我不确定,但我有个问题。
在SIM卡管理器部分下的设置中,当我必须为语音呼叫选择首选SIM卡时,我将获得以下四个选项:
当我选择询问总是选项,然后在打电话之前,我总是被要求选择一个SIM卡,显示在一个对话框中,打电话。我的问题是,我可以利用这个东西在我的应用程序中,我按下一个按钮打电话,但它总是问我一样,当我选择问总是选项。
对不起,我把这个问题弄得很长,但我认为这是必需的。请提前提供帮助并表示感谢。
编辑:
我如何做到这一点,每次我按下任何按钮(类似于询问始终选项在设置):

发布于 2016-07-27 06:22:43
代码:
private final static String simSlotName[] = {
"extra_asus_dial_use_dualsim",
"com.android.phone.extra.slot",
"slot",
"simslot",
"sim_slot",
"subscription",
"Subscription",
"phone",
"com.android.phone.DialingMode",
"simSlot",
"slot_id",
"simId",
"simnum",
"phone_type",
"slotId",
"slotIdx"
};
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + "any number"));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("com.android.phone.force.slot", true);
intent.putExtra("Cdma_Supp", true);
//Add all slots here, according to device.. (different device require different key so put all together)
for (String s : simSlotName)
intent.putExtra(s, 0); //0 or 1 according to sim.......
//works only for API >= 21
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
intent.putExtra("android.telecom.extra.PHONE_ACCOUNT_HANDLE", (Parcelable) " here You have to get phone account handle list by using telecom manger for both sims:- using this method getCallCapablePhoneAccounts()");
context.startActivity(intent);发布于 2017-06-01 04:22:47
TelecomManager telecomManager = (TelecomManager) this.getSystemService(Context.TELECOM_SERVICE);
List<PhoneAccountHandle> phoneAccountHandleList = telecomManager.getCallCapablePhoneAccounts();
Intent intent = new Intent(Intent.ACTION_CALL).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setData(Uri.parse("tel:" + number));
intent.putExtra("com.android.phone.force.slot", true);
intent.putExtra("Cdma_Supp", true);
if (simselected== 0) { //0 for sim1
for (String s : simSlotName)
intent.putExtra(s, 0); //0 or 1 according to sim.......
if (phoneAccountHandleList != null && phoneAccountHandleList.size() > 0)
intent.putExtra("android.telecom.extra.PHONE_ACCOUNT_HANDLE", phoneAccountHandleList.get(0));
} else { 1 for sim2
for (String s : simSlotName)
intent.putExtra(s, 1); //0 or 1 according to sim.......
if (phoneAccountHandleList != null && phoneAccountHandleList.size() > 1)
intent.putExtra("android.telecom.extra.PHONE_ACCOUNT_HANDLE", phoneAccountHandleList.get(1));
}
startActivity(intent);发布于 2018-03-24 14:45:01
我对这个问题有一个答案,因为我正在寻找这个选项。以下是几个步骤:
https://stackoverflow.com/questions/25524476
复制相似问题