I want to know how do I access the phone type info [whether it is GSM or CDMA] from TelephonyManager
. which function can I use for this:
My code for this is :
SubscriptionManager sm = SubscriptionManager.from(context);
List<SubscriptionInfo> sil = sm.getActiveSubscriptionInfoList();
sim_value[0]= sil.get(0).getDisplayName().toString();
sim_value[1]= sil.get(0).getIccId().toString();
sim_value[2]= String.valueOf(sil.get(0).getSimSlotIndex());
sim_value[3]= sil.get(0).getCarrierName().toString();
You can achieve this using Telephony Manager
you must declare following permission in AndroidManifest file..
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
Have an object of TelephonyMnager
TelephonyManager tm=(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
Get the Phone Type CDMA/GSM/NONE
int phoneType=tm.getPhoneType();
switch (phoneType)
{
case (TelephonyManager.PHONE_TYPE_CDMA):
// your code
break;
case (TelephonyManager.PHONE_TYPE_GSM)
// your code
break;
case (TelephonyManager.PHONE_TYPE_NONE):
// your code
break;
}
For more refer this Telephony Manager