Example usage for android.telephony TelephonyManager PHONE_TYPE_NONE

List of usage examples for android.telephony TelephonyManager PHONE_TYPE_NONE

Introduction

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

Prototype

int PHONE_TYPE_NONE

To view the source code for android.telephony TelephonyManager PHONE_TYPE_NONE.

Click Source Link

Document

No phone radio.

Usage

From source file:Main.java

public static boolean isPhoneAvailable() {
    return telephonyManager.getPhoneType() != TelephonyManager.PHONE_TYPE_NONE;
}

From source file:Main.java

public static String convertPhoneType(int type) {
    switch (type) {
    case TelephonyManager.PHONE_TYPE_NONE:
        return "NONE";
    case TelephonyManager.PHONE_TYPE_GSM:
        return "GSM";
    case TelephonyManager.PHONE_TYPE_CDMA:
        return "CDMA";
    case TelephonyManager.PHONE_TYPE_SIP:
        return "SIP";
    default:// w ww .  j  av a2s  . c  om
        return UNKNOWN;
    }
}

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 boolean isPhone(Context context) {
    TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    if (telephony.getPhoneType() == TelephonyManager.PHONE_TYPE_NONE) {
        return false;
    } else {/*w w w  .  jav  a  2 s.c o m*/
        return true;
    }
}

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 {//from w  w w .  j  a v a 2  s. c o m
        return false;
    }
}

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   w  w w  . j av  a2s . com*/
        return false;
    }
}

From source file:Main.java

/**
 * Returns a constant indicating the device phone type.
 * This indicates the type of radio used to transmit voice calls.
 * @param phone_type "getPhoneType()"// w ww. j av  a  2 s . c o m
 */
public static String getPhoneTypeStr(int phone_type) {
    switch (phone_type) {
    case TelephonyManager.PHONE_TYPE_NONE://0
        return "PHONE_TYPE_NONE";
    case TelephonyManager.PHONE_TYPE_GSM://1
        return "PHONE_TYPE_GSM";
    case TelephonyManager.PHONE_TYPE_CDMA://2
        return "PHONE_TYPE_CDMA";
    case TelephonyManager.PHONE_TYPE_SIP://3
        return "PHONE_TYPE_SIP";//API 11
    default:
        return UNKNOWN;
    }
}

From source file:Main.java

/**
 * this device has phone radio?//w  w w . j  ava 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;
    }
}

From source file:Main.java

public static boolean supportSMS(Context ctx) {
    //Froyo or above!!
    TelephonyManager telephonyManager1 = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE);
    boolean isPhone = !(telephonyManager1.getPhoneType() == TelephonyManager.PHONE_TYPE_NONE);
    boolean featureTelephony = ctx.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
    return isPhone && featureTelephony;
}