TelephonyManager getNetworkType - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for TelephonyManager getNetworkType method.

This code example shows how to use the following methods:getNetworkType
    } 
     
    public static boolean is2gNetwork(Context context) {
        TelephonyManager tm = (TelephonyManager) context.
			getSystemService(Context.TELEPHONY_SERVICE);
	    int type = tm.getNetworkType();
	    if (type == TelephonyManager.NETWORK_TYPE_GPRS
	    		|| type == TelephonyManager.NETWORK_TYPE_EDGE) {
	    	return true; 
	    } 
	    return false; 
    } 
     
     
	public static int getCurrentSdkVersion() { 
		return Build.VERSION.SDK_INT;
	} 
	 
	public Location getLocation(Context context) {
		LocationManager locMan = (LocationManager) context
7
CodeRank
This code example shows how to use the following methods:getNetworkType
			Context context = Director.getInstance().getContext();
			TelephonyManager tm = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
			if(tm == null)
				type = NetworkType.NONE;
			else { 
				int t = tm.getNetworkType();
				if(t == TelephonyManager.NETWORK_TYPE_GPRS || t == TelephonyManager.NETWORK_TYPE_UNKNOWN)
					type = NetworkType.G2;
				else if(t == TelephonyManager.NETWORK_TYPE_EDGE)
					type = NetworkType.EDGE;
				else 
					type = NetworkType.G3;
			} 
		} 
	 
		return type.ordinal();
	} 
	 
	/// check proxy existence or not 
	static boolean hasProxy() { 
7
CodeRank
This code example shows how to use the following methods:getNetworkType
     * @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;
    } 
 
} 
7
CodeRank
This code example shows how to use the following methods:getNetworkType
    } 
 
    TelephonyManager tm =
      (TelephonyManager)GeckoApp.mAppContext.getSystemService(Context.TELEPHONY_SERVICE);
 
    switch (tm.getNetworkType()) {
      case TelephonyManager.NETWORK_TYPE_IDEN:
      case TelephonyManager.NETWORK_TYPE_CDMA:
        return NetworkType.NETWORK_2_G;
      case TelephonyManager.NETWORK_TYPE_GPRS:
      case TelephonyManager.NETWORK_TYPE_1xRTT:
        return NetworkType.NETWORK_2_5_G;
      case TelephonyManager.NETWORK_TYPE_EDGE:
        return NetworkType.NETWORK_2_75_G;
      case TelephonyManager.NETWORK_TYPE_UMTS:
      case TelephonyManager.NETWORK_TYPE_EVDO_0:
        return NetworkType.NETWORK_3_G;
      case TelephonyManager.NETWORK_TYPE_HSPA:
      case TelephonyManager.NETWORK_TYPE_HSDPA:
      case TelephonyManager.NETWORK_TYPE_HSUPA:
7
CodeRank
This code example shows how to use the following methods:getDeviceId, getDeviceSoftwareVersion, getNetworkOperator, getNetworkOperatorName, getNetworkType
5
CodeRank
This code example shows how to use the following methods:getLine1Number, getNetworkOperatorName, getNetworkType, getPhoneType, getSimOperatorName
            @Override 
            public void onClick(View v) {
                TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
                 
                String str = "";
                str += "NetworkOperatorName:" + tm.getNetworkOperatorName() + "\n";
                str += "NetworkType:" + tm.getNetworkType() + "\n";
                str += "Line1Number:" + tm.getLine1Number() + "\n";
                str += "SimOperatorName:" + tm.getSimOperatorName() + "\n";
                str += "PhoneType:" + tm.getPhoneType() + "\n";          
                 
                text.setText(str);
            } 
        }); 
    } 
} 
6
CodeRank
This code example shows how to use the following methods:getNetworkType
        return telephonyManager.getVoiceMailNumber();
    } 
 
    public int getNetworkType() 
    { 
        return telephonyManager.getNetworkType();
    } 
 
    public int getPhoneType() 
    { 
        return telephonyManager.getPhoneType();
    } 
} 
7
CodeRank
This code example shows how to use the following methods:getCellLocation, getDeviceId, getNetworkOperator, getNetworkType, getSimOperatorName
		list.add("\nBuild Number: " + Build.DISPLAY);
		list.add("\nSDK API Level: " + Build.VERSION.SDK_INT);
 
		TelephonyManager phoneMgr = (TelephonyManager)mContext.getSystemService(Context.TELEPHONY_SERVICE);
//		list.add("\nPhone number" + phoneMgr.getLine1Number()); 
		list.add("\nSimOperatorName: " + phoneMgr.getSimOperatorName());
 
		String simType = "unknow";
		int type = phoneMgr.getNetworkType();
		if (type == TelephonyManager.NETWORK_TYPE_UMTS) {
			simType = "USIM/WCDMA";// 类型为UMTS定义为wcdma的USIM卡
		} else if (type == TelephonyManager.NETWORK_TYPE_GPRS) {
			simType = "SIM/GPRS";// 类型为GPRS定义为GPRS的SIM卡
		} else if (type == TelephonyManager.NETWORK_TYPE_EDGE) {
			simType = "SIM/EDGE";// 类型为EDGE定义为EDGE的SIM卡
		} else { 
			simType = "UIM/CDMA";// 类型为unknown定义为cdma的UIM卡
		} 
		list.add("\nSim Type: " + simType);
 

6
CodeRank
This code example shows how to use the following methods:getNetworkType
		context = getApplicationContext();
 
		// Toast current Network Type 
		tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
		String type = "UNKNOWN";
		if (tm.getNetworkType() == TelephonyManager.NETWORK_TYPE_UMTS)type = "UMTS";
		if (tm.getNetworkType() == TelephonyManager.NETWORK_TYPE_EDGE)type = "EDGE";
		if (tm.getNetworkType() == TelephonyManager.NETWORK_TYPE_GPRS)type = "GPRS";
		Toast.makeText(context, type, Toast.LENGTH_LONG).show();
 
		// Launch Activity RadioInfo 
		Intent i = new Intent();
		i.setClassName( "com.android.settings", "com.android.settings.RadioInfo" );
		startActivity(i);
		 
		// Close this Activity 
		finish();
	} 
} 
6
CodeRank
This code example shows how to use the following methods:getNetworkType
    	} 
    	return UNKNOWN_CELL;    	 
    } 
     
    private boolean is3GPPNetwork() { 
    	int type = m_telMgr.getNetworkType();
    	return (type == TelephonyManager.NETWORK_TYPE_EDGE
            || type == TelephonyManager.NETWORK_TYPE_GPRS 
        	|| type == TelephonyManager.NETWORK_TYPE_UMTS);
    } 
     
 
} 
6
CodeRank

Related TelephonyManager getNetworkType Questions & Answers:

getNetworkType Method Overview
See Code Examples for other Android TelephonyManager Methods: