Tuesday, December 26, 2017

get the Dual Sim Mobile Number in Android Example

//use permission READ_PHONE_STATE


if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP_MR1) {
    SubscriptionManager subscriptionManager = SubscriptionManager.from(getApplicationContext());
    List<SubscriptionInfo> subsInfoList = subscriptionManager.getActiveSubscriptionInfoList();

    Log.d("Test", "Current list = " + subsInfoList);

  /*  for (SubscriptionInfo subscriptionInfo : subsInfoList) {
        String number = subscriptionInfo.getNumber();
        Log.d("Test", " Number is  " + number);    }*/  for(int i=0;i<subsInfoList.size();i++)
  {
      SubscriptionInfo subscriptionInfo=subsInfoList.get(i);
      Log.e("Mobile "+""+i+"First",subscriptionInfo.getNumber());
  }
}

No comments:

Post a Comment

Featured Post

What is JavaScript? What is the role of JavaScript engine?

  The JavaScript is a Programming language that is used for converting static web pages to interactive and dynamic web pages. A JavaScript e...