Android examples for Network:Network Connection
is 2G Network Connection
//package com.java2s; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; public class Main { public static boolean is2G(Context context) { ConnectivityManager connectivityManager = (ConnectivityManager) context .getSystemService("connectivity"); NetworkInfo activeNetInfo = connectivityManager .getActiveNetworkInfo(); if ((activeNetInfo != null) && ((activeNetInfo.getSubtype() == 2) || (activeNetInfo.getSubtype() == 1) || (activeNetInfo .getSubtype() == 4))) { return true; }/*from www . j a v a 2s. c o m*/ return false; } }