List of usage examples for android.telephony TelephonyManager getPhoneType
public int getPhoneType()
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; }
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:org.mitre.svmp.client.IntentHandler.java
private static int isTelephonyEnabled(Context context) { int resId = 0; TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); if (tm != null) { if (tm.getPhoneType() != TelephonyManager.PHONE_TYPE_GSM && !context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) resId = R.string.intentHandler_toast_noTelephonyCDMA; else if (tm.getSimState() != TelephonyManager.SIM_STATE_READY) resId = R.string.intentHandler_toast_noTelephonyGSM; }//from ww w . j av a2s . co m return resId; }
From source file:Main.java
/** * Get ISO 3166-1 alpha-2 country code for this device (or null if not available) * * @param context Context reference to get the TelephonyManager instance from * @return country code or null/*ww w . ja va 2 s. co m*/ */ public static String getDeviceCountry(Context context) { try { final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); final String simCountry = tm.getSimCountryIso(); if (simCountry != null && simCountry.length() == 2) { // SIM country code is available return simCountry.toLowerCase(Locale.US); } else if (tm.getPhoneType() != TelephonyManager.PHONE_TYPE_CDMA) { // device is not 3G (would be unreliable) String networkCountry = tm.getNetworkCountryIso(); if (networkCountry != null && networkCountry.length() == 2) { // network country code is available return networkCountry.toLowerCase(Locale.US); } } } catch (Exception e) { } return null; }
From source file:uk.ac.ucl.excites.sapelli.shared.util.android.DeviceControl.java
/** * @param context//from w w w .j a v a 2s . c om * @return one of the TelephoneManager#PHONE_TYPE_* values */ public static int getPhoneType(Context context) { TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); return tm.getPhoneType(); }
From source file:com.cyanogenmod.account.util.CMAccountUtils.java
public static boolean isGSMPhone(Context context) { TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); int phoneType = telephonyManager.getPhoneType(); return phoneType == TelephonyManager.PHONE_TYPE_GSM; }
From source file:com.lewen.listener.vlc.Util.java
public static boolean isPhone() { TelephonyManager manager = (TelephonyManager) TBApplication.App.getApplicationContext() .getSystemService(Context.TELEPHONY_SERVICE); if (manager.getPhoneType() == TelephonyManager.PHONE_TYPE_NONE) { return false; } else {/*ww w . jav a 2 s . co m*/ return true; } }
From source file:com.oliversride.wordryo.Utils.java
public static boolean deviceSupportsSMS(Context context) { if (null == s_deviceSupportSMS) { boolean doesSMS = false; TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); if (null != tm) { int type = tm.getPhoneType(); doesSMS = TelephonyManager.PHONE_TYPE_NONE != type; }//from ww w .ja v a 2 s.c o m s_deviceSupportSMS = new Boolean(doesSMS); } return s_deviceSupportSMS; }
From source file:com.yamin.kk.vlc.Util.java
public static boolean isPhone() { TelephonyManager manager = (TelephonyManager) VLCApplication.getAppContext() .getSystemService(Context.TELEPHONY_SERVICE); if (manager.getPhoneType() == TelephonyManager.PHONE_TYPE_NONE) { return false; } else {// www.ja v a 2s .c o m return true; } }
From source file:Main.java
public static String getPhoneStatus(Context context) { TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String str = ""; str += "DeviceId(IMEI) = " + tm.getDeviceId() + "\n"; str += "DeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion() + "\n"; str += "Line1Number = " + tm.getLine1Number() + "\n"; str += "NetworkCountryIso = " + tm.getNetworkCountryIso() + "\n"; str += "NetworkOperator = " + tm.getNetworkOperator() + "\n"; str += "NetworkOperatorName = " + tm.getNetworkOperatorName() + "\n"; str += "NetworkType = " + tm.getNetworkType() + "\n"; str += "honeType = " + tm.getPhoneType() + "\n"; str += "SimCountryIso = " + tm.getSimCountryIso() + "\n"; str += "SimOperator = " + tm.getSimOperator() + "\n"; str += "SimOperatorName = " + tm.getSimOperatorName() + "\n"; str += "SimSerialNumber = " + tm.getSimSerialNumber() + "\n"; str += "SimState = " + tm.getSimState() + "\n"; str += "SubscriberId(IMSI) = " + tm.getSubscriberId() + "\n"; str += "VoiceMailNumber = " + tm.getVoiceMailNumber() + "\n"; return str;/* w w w .ja va 2 s. c o m*/ }