I am implementing an Android app that will allow users to purchase something by dialing a number from my app pressing a button. In single SIM devices it works nicely, but in dual sim devices, when I run my app and click on the "Purchase Button" a popup window automatically opens to ask me which SIM I want to use to dial (I didn't have to write code for this action, It automatically done by my device. Also when I normally call a friend using the default Phone App of my device this pop up window opens automatically to ask me which Sim I wanna use to dial and after selecting a sim it starts calling), but in case of my app after selecting an SIM , It doesn't work, It doesn't start dialing. But It starts dialing in single sim devices.
I have added <uses-permission android:name="android.permission.CALL_PHONE"></uses-permission>
correctly and my code works nicely on single SIM devices.
So what's the problem? Why it's not working on dual Sim devices?
My code:
Button button1maina = (Button) findViewById(R.id.Button03);
button1maina.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:" + "*566%23"));;
startActivity(callIntent);
}
});
Simply write these two line of code rest of thee this will automatically done by the system hear you don't worry about single/dual SIM
refer official guide for more detail http://developer.android.com/reference/android/content/Intent.html
You must specify the simcard to start the intent activity. First of all, check if the phone is Dual Sim with this link: https://stackoverflow.com/a/17499889/3743245
After that, try to ask the user which simcard he/she will use and pass that info like this:
or
and if doesn't work try this:
or