is 3G Network - Android Network

Android examples for Network:Network Connection

Description

is 3G Network

Demo Code


//package com.java2s;

import android.content.Context;

import android.net.ConnectivityManager;

import android.net.NetworkInfo.State;

public class Main {
    public static boolean is3GNetwork(Context context) {
        // mobile 3G Data Network
        ConnectivityManager conMan = (ConnectivityManager) context
                .getSystemService(Context.CONNECTIVITY_SERVICE);
        State mobile = conMan.getNetworkInfo(
                ConnectivityManager.TYPE_MOBILE).getState();
        if (mobile == State.CONNECTED || mobile == State.CONNECTING)
            return true;
        else/*from  ww w.ja va2  s  .  c om*/
            return false;
    }
}

Related Tutorials