Example usage for android.content Context TELEPHONY_SERVICE

List of usage examples for android.content Context TELEPHONY_SERVICE

Introduction

In this page you can find the example usage for android.content Context TELEPHONY_SERVICE.

Prototype

String TELEPHONY_SERVICE

To view the source code for android.content Context TELEPHONY_SERVICE.

Click Source Link

Document

Use with #getSystemService(String) to retrieve a android.telephony.TelephonyManager for handling management the telephony features of the device.

Usage

From source file:Main.java

public static String getDeviceId(Context context) {
    TelephonyManager phoneMgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return phoneMgr.getDeviceId();
}

From source file:Main.java

public static String getSimNumber(Context context) {
    TelephonyManager manager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return manager.getSimSerialNumber();
}

From source file:Main.java

public static String getDeviceId(Context ctx) {
    TelephonyManager telephonyManager = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE);
    return telephonyManager.getDeviceId();
}

From source file:Main.java

public static String getPhoneNumber(Context context) {
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    String phoneNumberText = tm.getLine1Number();
    return phoneNumberText;
}

From source file:Main.java

public static String getLinePhone(Context context) {
    TelephonyManager phoneMgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return phoneMgr.getLine1Number();
}

From source file:Main.java

public static String IMEI(Context context) {
    TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    String IMEI = telephonyManager.getDeviceId();
    return IMEI;/*  w  ww .  j a v a2 s .  c  o m*/
}

From source file:Main.java

public static String getImsi(Context mContext) {
    TelephonyManager telephonyMgr = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
    return telephonyMgr.getSubscriberId();
}

From source file:Main.java

public static String getDeviceId(Context context) {
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    if (tm == null) {
        return "000000000000000";
    }// w  w  w .  j a  va  2s .  c  o m
    return tm.getDeviceId();
}

From source file:Main.java

public static boolean isSIMPresent(Context context) {
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    if (tm.getSimState() == TelephonyManager.SIM_STATE_ABSENT) {
        return false;
    } else//from  w  w  w  .ja va 2 s. c o  m
        return true;
}

From source file:Main.java

public static String getPhoneNumber(Context context) {
    TelephonyManager manager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return manager.getLine1Number();
}