//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