import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.telephony.TelephonyManager;
import java.text.DecimalFormat;
public class TDevice {
private static final int NETWORK_TYPE_UNAVAILABLE = -1;
// private static final int NETWORK_TYPE_MOBILE = -100;
private static final int NETWORK_TYPE_WIFI = -101;
private static final int NETWORK_CLASS_WIFI = -101;
private static final int NETWORK_CLASS_UNAVAILABLE = -1;
/**
* Unknown network class.
*/
private static final int NETWORK_CLASS_UNKNOWN = 0;
/**
* Class of broadly defined "2G" networks.
*/
private static final int NETWORK_CLASS_2_G = 1;
/**
* Class of broadly defined "3G" networks.
*/
private static final int NETWORK_CLASS_3_G = 2;
/**
* Class of broadly defined "4G" networks.
*/
private static final int NETWORK_CLASS_4_G = 3;
private static DecimalFormat df = new DecimalFormat("#.##");
/**
* Network type is unknown
*/
public static final int NETWORK_TYPE_UNKNOWN = 0;
/**
* Current network is GPRS
*/
public static final int NETWORK_TYPE_GPRS = 1;
/**
* Current network is EDGE
*/
public static final int NETWORK_TYPE_EDGE = 2;
/**
* Current network is UMTS
*/
public static final int NETWORK_TYPE_UMTS = 3;
/**
* Current network is CDMA: Either IS95A or IS95B
*/
public static final int NETWORK_TYPE_CDMA = 4;
/**
* Current network is EVDO revision 0
*/
public static final int NETWORK_TYPE_EVDO_0 = 5;
/**
* Current network is EVDO revision A
*/
public static final int NETWORK_TYPE_EVDO_A = 6;
/**
* Current network is 1xRTT
*/
public static final int NETWORK_TYPE_1xRTT = 7;
/**
* Current network is HSDPA
*/
public static final int NETWORK_TYPE_HSDPA = 8;
/**
* Current network is HSUPA
*/
public static final int NETWORK_TYPE_HSUPA = 9;
/**
* Current network is HSPA
*/
public static final int NETWORK_TYPE_HSPA = 10;
/**
* Current network is iDen
*/
public static final int NETWORK_TYPE_IDEN = 11;
/**
* Current network is EVDO revision B
*/
public static final int NETWORK_TYPE_EVDO_B = 12;
/**
* Current network is LTE
*/
public static
设备获取联网状态以及状态栏高度TDevice
最新推荐文章于 2024-03-27 22:38:40 发布
本文介绍了一个名为TDevice的工具,用于初略获取Android设备的网络状态。通过引用NetUtils类,开发者可以详细了解到如何检查设备的联网状态。参考链接:https://blog.csdn.net/NiuAGeNiuC/article/details/91373286
摘要由CSDN通过智能技术生成