Java tutorial
//package com.java2s; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; public class Main { public static String getNetworkInfo(Context act) { ConnectivityManager cm = (ConnectivityManager) act.getSystemService(Context.CONNECTIVITY_SERVICE); if (cm == null) return null; NetworkInfo info = cm.getActiveNetworkInfo(); if (info != null) return info.toString(); return null; } }