Skip to content Skip to sidebar Skip to footer

Call From Second Sim

I have a dual sim android phone. I am using this code to make a call: private void callBack(String phone, Context context) { Intent callIntent = new Intent(Intent.ACTION_CA

Solution 1:

This seems to work on a large range of dual sim devices as Motorola, Micromax, HTC, Samsung

intent.putExtra("com.android.phone.extra.slot", 0); //For sim 1

OR

intent.putExtra("com.android.phone.extra.slot", 1); //For sim 2

and if doesn't work try this, In Samsung S duos this works just fine.

intent.putExtra("simSlot", 0); //For sim 1

OR

intent.putExtra("simSlot", 1); //For sim 2

unfortunately for these things we have to get into hit/trial mode as no official documentation is there for dual-sim support.

Solution 2:

finalIntentintent=newIntent(Intent.ACTION_CALL, Uri.parse("tel:" + phoneNumberOrUssd));
    finalintsimSlotIndex=1; //Second sim slottry {
        finalMethodgetSubIdMethod= SubscriptionManager.class.getDeclaredMethod("getSubId", int.class);
        getSubIdMethod.setAccessible(true);
        finallongsubIdForSlot= ((long[]) getSubIdMethod.invoke(SubscriptionManager.class, simSlotIndex))[0];

        finalComponentNamecomponentName=newComponentName("com.android.phone", "com.android.services.telephony.TelephonyConnectionService");
        finalPhoneAccountHandlephoneAccountHandle=newPhoneAccountHandle(componentName, String.valueOf(subIdForSlot));
        intent.putExtra("android.telecom.extra.PHONE_ACCOUNT_HANDLE", phoneAccountHandle);
    } catch (Exception e) {
        e.printStackTrace();
    }

    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);

Work on dual-sim Asus Fonepad 7 Android 5.0

Solution 3:

Android does not provide APIs to support dual SIM devices. SIM Card related APIs of Android only support default SIM Card(usually SIM #1). It is hardware implementation to support dual SIM on Android, therefore device manufacturer have to implement their own APIs or customize the source code to support their hardware component. You can contact to device manufacturer for dual SIM supporting SDK.

Post a Comment for "Call From Second Sim"