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 getCurrentPhoneNumber(Context context) {
    TelephonyManager mTelephonyMgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return mTelephonyMgr.getLine1Number();
}

From source file:Main.java

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

From source file:Main.java

public static String getImei(Context cx) {
    String Imei = "";
    try {//from   w  ww.  ja  v  a 2s.c o  m
        Imei = ((TelephonyManager) cx.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId();
    } catch (Exception e) {
    }
    return Imei;
}

From source file:Main.java

public static boolean isTabletDevice(Context mContext) {
    TelephonyManager telephony = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
    int type = telephony.getPhoneType();
    if (type == TelephonyManager.PHONE_TYPE_NONE) {
        return true;
    } else {/*from   w  w w  .  j  ava2  s  .c om*/
        return false;
    }
}

From source file:Main.java

public static String getImei(Context context, String imei) {
    TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    imei = telephonyManager.getDeviceId();
    return imei;/*from  w ww.ja  v a 2s. c om*/
}

From source file:Main.java

public static boolean isChinaUnicom(final Context context) {
    final TelephonyManager telManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    final String operator = telManager.getSimOperator();
    return "46001".equals(operator);
}

From source file:Main.java

public static String getIMEI(Context context) {
    return ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId();

}

From source file:Main.java

public static String getIMEI(Context context) {
    try {/*from w  w  w  . jav  a  2s.co m*/
        TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        String imeiCode = tm.getDeviceId();
        return imeiCode;
    } catch (Exception e) {
        e.printStackTrace();
        return "";
    }
}

From source file:Main.java

public static boolean isCheckSimCardAvailable(Context context) {
    final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    if (tm.getSimState() != TelephonyManager.SIM_STATE_READY) {
        return false;
    }//  w w  w .j  a v  a  2s  . co m
    return true;
}

From source file:Main.java

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