从android通过指定的SIM卡拨打电话

xn1cxnb4  于 2023-02-14  发布在  Android
关注(0)|答案(5)|浏览(455)

我想知道通过双卡安卓设备上选定的SIM卡从安卓打电话的可能性。是否可以通过编程选择特定的SIM卡进行通话?

kr98yfug

kr98yfug1#

Android SDK并没有提供API来控制双卡手机使用的SIM卡。事实上,Android甚至不真正支持双卡手机。所有双卡设备都经过了制造商的广泛修改。
你不能通过Android SDK控制SIM卡,如果有OEM为他们的设备提供这样的API,我不知道,但你可以尝试直接询问你的双SIM卡设备的制造商,他们的设备上是否存在这样的API。

a0x5cqrl

a0x5cqrl2#

使用ACTION_DIAL让用户选择他们的SIM卡。

p3rjfoxz

p3rjfoxz3#

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);
}

检查是否为双卡,通过以下链接
Android:检查手机是否是双卡

xpszyzbs

xpszyzbs4#

如果手机是双卡,你想从sim2打电话,然后使用1如果你想使用sim1,然后在intent中使用0。putextra

Intent intentcall = new Intent(Intent.ACTION_CALL);

 intentcall.putExtra("simSlot", 1);
 intentcall.setData(Uri.parse("tel:"+dialNumber));
 startActivity(intentcall);
46scxncf

46scxncf5#

我也遇到了同样的问题,碰巧在androidnoonintent.putExtra("com.android.phone.extra.slot", 0); // for sim 1 and '1' for sim2 worked well上找到了一个解决方案

相关问题