https://www.codota.com/code/java/methods/android.telephony.TelephonyManager/getSubscriberId


String ts = Context.TELEPHONY_SERVICE;
TelephonyManager mTelephonyMgr = (TelephonyManager) getSystemService(ts);
String imsi = mTelephonyMgr.getSubscriberId();
String imei = mTelephonyMgr.getDeviceId();
 TelephonyManager TM = (TelephonyManager)    getSystemService(Context.TELEPHONY_SERVICE);

// IMEI No.
String imeiNo = TM.getDeviceId();

// IMSI No.
String imsiNo = TM.getSubscriberId();

// SIM Serial No.
String simSerialNo  = TM.getSimSerialNumber();

// Android Unique ID
String androidId =    System.getString(this.getContentResolver(),Settings.Secure.ANDROID_ID);

getLine1Number() Returns blank, not null

 TelephonyManager tMgr = (TelephonyManager) 
         ShowMyLocation.this.getSystemService(Context.TELEPHONY_SERVICE);

String MyPhoneNumber = "0000000000";

try 
{
  MyPhoneNumber =tMgr.getLine1Number();
}
catch(NullPointerException ex)
{
}

if(MyPhoneNumber.equals("")){
  MyPhoneNumber = tMgr.getSubscriberId();

getLine1Number() Returns blank, not null

 TelephonyManager tMgr = (TelephonyManager) 
         ShowMyLocation.this.getSystemService(Context.TELEPHONY_SERVICE);

String MyPhoneNumber = "0000000000";

try 
{
  MyPhoneNumber =tMgr.getLine1Number();
}
catch(NullPointerException ex)
{
}

if(MyPhoneNumber.equals("")){
  MyPhoneNumber = tMgr.getSubscriberId();
}

How can I get the phone number without getLine1Number() method

 TelephonyManager telMan = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String phoneNumber = "00";
try {
  phoneNumber =telMan.getLine1Number();
} catch(NullPointerException ex) {
  ex.printStackTrace();
}
if(phoneNumber.equals("")){
  phoneNumber = telMan.getSubscriberId();
}

android statistic 3g traffic for each APP, how?

 private static String getActiveSubscriberId(Context context) {
  final TelephonyManager tele = TelephonyManager.from(context);
  final String actualSubscriberId = tele.getSubscriberId();
  return SystemProperties.get(TEST_SUBSCRIBER_PROP, actualSubscriberId);
}

How to get Device Information in Android

 // Code For IMEI AND IMSI NUMBER

String serviceName = Context.TELEPHONY_SERVICE;
TelephonyManager m_telephonyManager = (TelephonyManager) getSystemService(serviceName);
String IMEI,IMSI;
IMEI = m_telephonyManager.getDeviceId();
IMSI = m_telephonyManager.getSubscriberId();

Retrieving SIM ID

TelephonyManager mTelephonyMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
 String imsi = mTelephonyMgr.getSubscriberId();
 String imei = mTelephonyMgr.getDeviceId(); 
 String simno = mTelephonyMgr.getSimSerialNumber();
 Log.v("", ""+imsi);
 Log.v("", ""+imei);
 Log.v("", ""+simno);

How to get sim id while receiving call?

TelephonyManager mTelephonyMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
 String imsi = mTelephonyMgr.getSubscriberId();
 String imei = mTelephonyMgr.getDeviceId(); 
 String simno = mTelephonyMgr.getSimSerialNumber();

Android mobile usage history NetworkStatsManager

TelephonyManager  tm = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);
 String subscriberID = tm.getSubscriberId();
 NetworkStats networkStatsByApp = networkStatsManager.queryDetailsForUid(ConnectivityManager.TYPE_MOBILE, subscriberID, start, end, uid);

Calculating mobile and wifi data usage of each application in android

 private static String getActiveSubscriberId(Context context) {
  final TelephonyManager tele = TelephonyManager.from(context);
  final String actualSubscriberId = tele.getSubscriberId();
  return SystemProperties.get(TEST_SUBSCRIBER_PROP, actualSubscriberId);
}

Reading device phone number throws NULLPointerException

 TelephonyManager tMgr = (TelephonyManager) 
         ShowMyLocation.this.getSystemService(Context.TELEPHONY_SERVICE);

String MyPhoneNumber = "0000000000";

try 
{
  MyPhoneNumber =tMgr.getLine1Number();
}
catch(NullPointerException ex)
{
}

if(MyPhoneNumber.equals("")) 
  MyPhoneNumber = tMgr.getSubscriberId();

Get Unique ID of Android Device?

 TelephonyManager TM = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);

// IMEI No.
String imeiNo = TM.getDeviceId();

// IMSI No.
String imsiNo = TM.getSubscriberId();

// SIM Serial No.
String simSerialNo  = TM.getSimSerialNumber();

// Android Unique ID
String androidId = System.getString(this.getContentResolver(),Settings.Secure.ANDROID_ID);

android.permission.READ_PHONE_STATE permission denied

TelephonyManager TM = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
 // IMEI No.
 String imeiNo = TM.getDeviceId();
 // IMSI No.
 String imsiNo = TM.getSubscriberId();
 // SIM Serial No.
 String simSerialNo  = TM.getSimSerialNumber();
 // Android Unique ID
 String androidId = System.getString(this.getContentResolver(),Settings.Secure.ANDROID_ID);

How can I find the data usage on a per-application basis on Android?

 private static String getActiveSubscriberId(Context context) {
  final TelephonyManager tele = TelephonyManager.from(context);
  final String actualSubscriberId = tele.getSubscriberId();
  return SystemProperties.get(TEST_SUBSCRIBER_PROP, actualSubscriberId);
}

Is there any way to get unique hardware ID on android devices?

String ts = Context.TELEPHONY_SERVICE;
 TelephonyManager mTelephonyMgr = (TelephonyManager) getSystemService(ts);
 String imsi = mTelephonyMgr.getSubscriberId();
 String imei = mTelephonyMgr.getDeviceId();