Make call using a specified SIM in a Dual SIM Device

前端 未结 3 2097
独厮守ぢ
独厮守ぢ 2020-12-08 15:27

I have been searching for this from past few days and I came to know that:

\"Dual SIM is not supported in Android out of the box. It is a custom modification by manu

3条回答
  •  抹茶落季
    2020-12-08 16:08

    TelecomManager telecomManager = (TelecomManager) this.getSystemService(Context.TELECOM_SERVICE);
    List    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);
    

提交回复
热议问题