示例#1
0
    public void checkInternetSpeed()
    {
        if (!isChecking)
        {
            isChecking = true;
            UpdateStatus("Checking...");

            if (internetPlugin.IsMobileConnected())
            {
                // check mobile speed here
                if (mobileConnectionText != null)
                {
                    mobileConnectionText.text = "mobile is connected";
                    isMobileConnected         = true;
                }

                if (internetPlugin.IsMobileConnectionFast())
                {
                    isMobileFast = true;
                    UpdateMobileSpeed("mobile is fast");
                    // do something here
                }
                else
                {
                    isMobileFast = false;
                    UpdateMobileSpeed("mobile is slow");
                    // do something here
                }
            }
            else
            {
                isMobileConnected = false;
                if (mobileConnectionText != null)
                {
                    mobileConnectionText.text = "mobile is not connected";
                }
            }

            if (internetPlugin.IsWifiConnected())
            {
                isWifiConnected = true;
                if (wifiConnectionText != null)
                {
                    wifiConnectionText.text = "wifi is connected";
                }
                internetPlugin.ScanWifi();
            }
            else
            {
                isWifiConnected = false;
                if (wifiConnectionText != null)
                {
                    wifiConnectionText.text = "wifi is not connected";
                }

                isChecking = false;
                UpdateStatus("Done Checking.");
                FinalCheck();
            }
        }
    }