【问题标题】:how to determine if network type is 2g, 3g or 4g using xamarin essential如何使用 xamarin essential 确定网络类型是 2g、3g 还是 4g
【发布时间】:2019-06-07 13:46:30
【问题描述】:

如何使用 xamarin essential 确定网络类型是 2g、3g 还是 4g

我知道 xamarin essential 具有识别连接类型的功能

var current = Connectivity.NetworkAccess;

if (current == NetworkAccess.Internet)
{
     // Connection to internet is available
}

但如果是互联网类型,那么我想知道它是 2g/3g/4g/5g

【问题讨论】:

标签: c# xamarin xamarin.forms cross-platform


【解决方案1】:

检查连接插件 https://github.com/jamesmontemagno/ConnectivityPlugin 和连接类型

public enum ConnectionType
{
    /// <summary>
    /// Cellular connection, 3G, Edge, 4G, LTE
    /// </summary>
    Cellular,
    /// <summary>
    /// Wifi connection
    /// </summary>
    WiFi,
    /// <summary>
    /// Desktop or ethernet connection
    /// </summary>
    Desktop,
    /// <summary>
    /// Wimax (only android)
    /// </summary>
    Wimax,
    /// <summary>
    /// Other type of connection
    /// </summary>
    Other,
    /// <summary>
    /// Bluetooth connection
    /// </summary>
    Bluetooth
}

【讨论】:

  • 蜂窝类型是否为2G/3G/4G/5G并没有真正给出答案
猜你喜欢
  • 2023-03-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-05-24
  • 1970-01-01
相关资源
最近更新 更多