private string GetConnectivityType()
        {
            var profile = _networkInfo.GetInternetConnectionProfile();

            if (profile == null)
            {
                return(CONNECTION_TYPE_NONE);
            }

            switch (profile.ConnectionType)
            {
            case NetworkConnectionType.Unknown:
                return(CONNECTION_TYPE_UNKNOWN);

            case NetworkConnectionType.None:
                return(CONNECTION_TYPE_NONE);

            case NetworkConnectionType.Cellular:
                return(CONNECTION_TYPE_CELLULAR);

            case NetworkConnectionType.Ethernet:
                return(CONNECTION_TYPE_ETHERNET);

            case NetworkConnectionType.Wifi:
                return(CONNECTION_TYPE_WIFI);

            case NetworkConnectionType.Other:
                return(CONNECTION_TYPE_OTHER);

            default:
                return(CONNECTION_TYPE_UNKNOWN);
            }
        }
Esempio n. 2
0
        private string GetConnnectivityType()
        {
            var profile = _networkInfo.GetInternetConnectionProfile();

            return(profile?.ConnectivityLevel.ToString() ?? "None");
        }