How to get carrier name from dual sim phone Android?

后端 未结 3 736
臣服心动
臣服心动 2021-01-07 06:30

I am able to get the carrier name from duel SIM phone.

I used the following code but it works only single SIM phone.

TelephonyManager telephonyManage         


        
3条回答
  •  鱼传尺愫
    2021-01-07 07:01

    Using "SubscriptionManager" we can know the Carrier names of the dual sim of the android mobile.

    SubscriptionManager subscriptionManager=(SubscriptionManager)getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
    
                List subscriptionInfoList=subscriptionManager.getActiveSubscriptionInfoList();
    
                if(subscriptionInfoList!=null && subscriptionInfoList.size()>0){
                   for(SubscriptionInfo info:subscriptionInfoList){
                      String carrierName = info.getCarrierName().toString();
                       String mobileNo=info.getNumber();
                       String countyIso=info.getCountryIso();
                       int dataRoaming=info.getDataRoaming();
    
                   }
    
                }
    

提交回复
热议问题