Android juzga que la red actual es 5G

La clase Google TelephonyManager proporciona el método correspondiente

TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
            int networkType = telephonyManager.getNetworkType();
            // 这里对应的值为20 只有依赖为android 10.0才有此属性 
            if(networkType ==TelephonyManager.NETWORK_TYPE_NR){
            	Log.i(TAG,"5G");
            }

La descripción oficial de Google es: La
dirección es: https://developer.android.com/reference/android/telephony/TelephonyManager

int	NETWORK_TYPE_NR
Current network is NR(New Radio) 5G.
NETWORK_TYPE_NR
Added in API level 29
public static final int NETWORK_TYPE_NR
Current network is NR(New Radio) 5G.

Constant Value: 20 (0x00000014)

 

Supongo que te gusta

Origin blog.csdn.net/weixin_40611659/article/details/108747483
Recomendado
Clasificación