I want to get both the sim numbers in a dual sim device.
You can receive calls and messages to both SIM cards. Before you can use the SIM cards, you have to enable them in the Dual SIM settings menu. Data traffic can only be handled on one SIM card at a time and you can select which SIM card you want to use.
Work with API > 21
Need permission android.Manifest.permission.READ_PHONE_STATE.
public class SplahActivity extends AppCompatActivity {
private Context context;
private SubscriptionManager mSubscriptionManager;
public static boolean isMultiSimEnabled = false;
public static String defaultSimName;
public static List<SubscriptionInfo> subInfoList;
public static ArrayList<String> Numbers;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
context = this;
setContentView(R.layout.activity_splah);
Numbers = new ArrayList<String>();
mSubscriptionManager = SubscriptionManager.from(context);
GetCarriorsInformation();
}
private void GetCarriorsInformation() {
subInfoList = mSubscriptionManager.getActiveSubscriptionInfoList();
if (subInfoList.size() > 1) {
isMultiSimEnabled = true;
}
for (SubscriptionInfo subscriptionInfo : subInfoList) {
Numbers.add(subscriptionInfo.getNumber());
}
}
}
SubscriptionManager Api 22 Android Official
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With