【问题标题】:How to get WIFI SSID in Android 10.0?如何在 Android 10.0 中获取 WIFI SSID?
【发布时间】:2019-09-16 08:35:16
【问题描述】:

在 Android 9.0&8.0 中获取 SSID 没有问题
但我无法在 Android 10.0(Q) 中获取 SSID。
我应该怎么做?以及 android 10.0 中关于 wifi 的文档链接在哪里?我试图找到该文档,但找不到。

在 Android 9.0&8.0 中获取 SSID 没有问题

WifiManager mWifiManager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
assert mWifiManager != null;
WifiInfo info = mWifiManager.getConnectionInfo();
return info.getSSID();
ConnectivityManager connManager = (ConnectivityManager) context.getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
assert connManager != null;
NetworkInfo networkInfo = connManager.getActiveNetworkInfo();
if (networkInfo.isConnected()) {
     if (networkInfo.getExtraInfo() != null) {
        return networkInfo.getExtraInfo().replace("\"", "");
    }
}

【问题讨论】:

    标签: android wifi android-wifi


    【解决方案1】:

    想要get.check原帖

    从 android 8.0 开始,我们将不会获得已连接的 SSID 除非打开 GPS。

    Get SSID when WIFI is connected

    WifiManager mWifiManager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
    assert mWifiManager != null;
    WifiInfo info = mWifiManager.getConnectionInfo();
    return info.getSSID();
    

    【讨论】:

      猜你喜欢
      • 2019-03-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-30
      • 2021-10-10
      • 2021-02-05
      • 2015-06-26
      • 2014-02-18
      相关资源
      最近更新 更多