When I click phone call button, how to choose skype, viber, sim1 or sim2, ect. Now, it is called by sim2. I want to choose. I search on Google, no found my problem.
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:" + "123456789"));
try {
startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
}
Permissions in Manifest
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
Reset App preferences before starting intent
Settings->Apps/Application Manager -> Default/Downloaded Apps -> Click on overflow icon (i.e. three dots icon on top right of the screen) -> Reset App Preferences.
Your code looks fine.
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:" + "123456789"));
try {
startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
}