Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; public class Main { /** * get mobile NetWork Type * * @param context * @return */ public static String getNetWorkType(Context context) { ConnectivityManager connectivityManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo workinfo = connectivityManager.getActiveNetworkInfo(); if (workinfo != null) { if (workinfo.getType() == ConnectivityManager.TYPE_BLUETOOTH) { return "b"; } if (workinfo.getType() == ConnectivityManager.TYPE_MOBILE) { return "m"; } if (workinfo.getType() == ConnectivityManager.TYPE_WIFI) { return "w"; } } return null; } }