Unity 判断当前应用网络状况 NoNet/wifi/4g

网络不可用时:

if (Application.internetReachability== NetworkReachability.NotReachable)        
    //Do Something

使用wifi时:

if (Application.internetReachability == NetworkReachability.ReachableViaLocalAreaNetwork)                 
    //Do Something

使用移动网络时:

if (Application.internetReachability == NetworkReachability.ReachableViaCarrierDataNetwork)               
    //Do Something

猜你喜欢

转载自blog.csdn.net/qq302756113/article/details/80080607
今日推荐