Example usage for android.telephony TelephonyManager getPhoneType

List of usage examples for android.telephony TelephonyManager getPhoneType

Introduction

In this page you can find the example usage for android.telephony TelephonyManager getPhoneType.

Prototype

public int getPhoneType() 

Source Link

Document

Returns a constant indicating the device phone type.

Usage

From source file:Main.java

public static boolean isPhone(Context context) {
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return tm.getPhoneType() != TelephonyManager.PHONE_TYPE_NONE;
}

From source file:Main.java

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

From source file:Main.java

public static boolean isPad() {
    TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    if (telephony.getPhoneType() == TelephonyManager.PHONE_TYPE_NONE) {
        return true;
    } else {// ww  w  .j  a va  2 s .c o m
        return false;
    }
}

From source file:Main.java

public static boolean isPhone(Context context) {
    TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    if (telephony.getPhoneType() == TelephonyManager.PHONE_TYPE_NONE) {
        return false;
    } else {/*from w w  w  .  j a va 2s  . c  o  m*/
        return true;
    }
}

From source file:Main.java

public static int getPhoneType(Context context) {
    int phoneType = 0;
    try {/*from   ww w . j  a va 2 s . c  o m*/
        TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        phoneType = tm.getPhoneType();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return phoneType;
}

From source file:Main.java

public static boolean hasSimFeature(final Context context) {

    TelephonyManager telephonyManager1 = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);

    return telephonyManager1.getPhoneType() != TelephonyManager.PHONE_TYPE_NONE;

}

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   ww w.  j ava2s . co m
        return false;
    }
}

From source file:Main.java

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

From source file:Main.java

public static int getPhoneType(Context context) {
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return tm != null ? tm.getPhoneType() : -1;
}

From source file:Main.java

/**
 * this device has phone radio?// w  ww.  j  av a 2  s.c  o  m
 *
 * @param context
 * @return
 */
public static boolean isPhone(Context context) {
    TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    int type = telephony.getPhoneType();
    if (type == TelephonyManager.PHONE_TYPE_NONE) {
        return false;
    } else {
        return true;
    }
}