Java tutorial
//package com.java2s; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; public class Main { public static boolean Is3GAvailable(Context context) { ConnectivityManager m_NetConnectMgr = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); boolean bConnect = false; try { if (m_NetConnectMgr == null) return false; NetworkInfo info = m_NetConnectMgr.getNetworkInfo(ConnectivityManager.TYPE_MOBILE); bConnect = (info.isAvailable() && info.isConnected()); } catch (Exception e) { return false; } return bConnect; } }