为什么下面的代码显示一个网络为mobile[lte],尽管我检查的传输类型是wifi?

c2e8gylq  于 2021-07-04  发布在  Java
关注(0)|答案(0)|浏览(172)
final NetworkInfo netInfo = connectivityManager.getNetworkInfo(network);
NetworkCapabilities actNw = connectivityManager.getNetworkCapabilities(nw);
if(actNw != null && (actNw.hasTransport(NetworkCapabilities.TRANSPORT_WIFI))){
   Timber.d("NetWorkDetails_%s",netInfo);
}

上面的代码我在一个循环中运行,allnetworks将日志显示为

NetWorkDetails_Wifi[type: MOBILE[LTE], state: CONNECTED/CONNECTED, reason: (unspecified), extra: ims, failover: false, available: true, roaming: false]
NetWorkDetails_Wifi[type: WIFI[], state: CONNECTED/CONNECTED, reason: (unspecified), extra: (none), failover: false, available: true, roaming: false]

为什么它包括移动[lte],即使我检查的传输类型为wifi?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题