`
// Call on clicking the call menu
private void makeCall(int correct) {
// TODO Auto-generated method stub
TelephonyInfo telephonyInfo = TelephonyInfo.getInstance(this);
String imsiSIM1 = telephonyInfo.getImsiSIM1();
String imsiSIM2 = telephonyInfo.getImsiSIM2();
boolean isSIM1Ready = telephonyInfo.isSIM1Ready();
boolean isSIM2Ready = telephonyInfo.isSIM2Ready();
boolean isDualSIM = telephonyInfo.isDualSIM();
Toast.makeText(
NavigationDrawer.this,
" IME1 : " + imsiSIM1 + "\n" + " IME2 : " + imsiSIM2 + "\n"
+ " IS DUAL SIM : " + isDualSIM + "\n"
+ " IS SIM1 READY : " + isSIM1Ready + "\n"
+ " IS SIM2 READY : " + isSIM2Ready + "\n",
Toast.LENGTH_LONG).show();
if (!isDualSIM) {
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:" + "9841967608"));
intent.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
startActivity(intent);
} else if (isDualSIM) {
new AlertDialog.Builder(NavigationDrawer.this)
.setMessage("Choose the SIM")
.setPositiveButton("SIM2",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {
Intent intent = new Intent(
Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:"
+ "9841967608"));
intent.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
intent.putExtra("simSlot", 1);
startActivity(intent);
}
})
.setNegativeButton("SIM1",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {
Intent intent = new Intent(
Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:"
+ "9841967608"));
intent.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
intent.putExtra("simSlot", 0);
startActivity(intent);
}
})
.show();
}
}`
I am doing a project where I have to check whether the device contains one or two SIM inserted into it. I only need to know the no of SIMs inside the device not the IMEI no. or IMSI no. I tried the the link Android : Check whether the phone is dual SIM but it does not work in my Samsung Duos device.How can my problem be solved?Help!
In my toolbar there is a call menu item which on clicking should check whether the device has one or two SIMs inserted. If the device contains one SIM, call should be made directly using the default SIM, else the alert dialog box should be shown with the options to choose the SIM(SIM1 or SIM2) with which you want to call the number. I have used the TelephonyInfo.java class provided in the link above.