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 tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return tm.getDeviceId();
}

From source file:Main.java

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

From source file:Main.java

public static String getIMEI(Context context) {
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);

    String imei = tm.getSimSerialNumber();
    return imei;//ww  w  .  ja v  a2  s . c o m
}

From source file:Main.java

public static boolean canMakeCall(Context ctx) {
    TelephonyManager manager = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE);
    return manager.getSimState() == TelephonyManager.SIM_STATE_READY
            && (manager.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM
                    || manager.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA);
}

From source file:Main.java

public static int getNetworkType(Context context) {
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return tm.getNetworkType();
}

From source file:Main.java

public static String getCarrierName(Context context) {
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return tm == null ? "" : tm.getSimOperatorName();
}

From source file:Main.java

public static String getIMSI(Context context) {
    TelephonyManager phone = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    String imsi = phone.getSubscriberId();
    return imsi == null ? "" : imsi;
}

From source file:Main.java

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

From source file:Main.java

public static String getIccid(Context context) {
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    if (tm == null) {
        return "000000000000000";
    }/*from   w w w.j a va 2s. c om*/
    return tm.getSimSerialNumber();
}

From source file:Main.java

public static String getIMSI(Context context) {
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    String imsi = tm.getSubscriberId();
    if (imsi == null)
        imsi = "";
    return imsi;//  w w w .ja  va2s.c  om
}