public class NetWorkUtil { //判断是不是wifi public static boolean isNetWork(Context context){ //获取网络管理 ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); //获取网络信息 NetworkInfo info = connectivityManager.getActiveNetworkInfo(); if(info != null && info.getType() == ConnectivityManager.TYPE_WIFI){ return true; } return false; } }
封装网络状态工具类,判断有无网络
猜你喜欢
转载自blog.csdn.net/qq_42809182/article/details/83381777
今日推荐
周排行