Code example for TelephonyManager

Methods: getNetworkType

0
     * @return true, if is umts 
     */ 
    public static boolean isUmts(final Context ctx) {
	TelephonyManager tm = (TelephonyManager) ctx.getSystemService(
	    Context.TELEPHONY_SERVICE);
	return tm.getNetworkType() >= TelephonyManager.NETWORK_TYPE_UMTS;
    } 
 
    /** 
     * Checks if is edge. 
     * @param ctx the ctx 
     * @return true, if is edge 
     */ 
    public static boolean isEdge(final Context ctx) {
	TelephonyManager tm = (TelephonyManager) ctx.getSystemService(
	    Context.TELEPHONY_SERVICE);
	return tm.getNetworkType() == TelephonyManager.NETWORK_TYPE_EDGE;
    } 
 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE