Xamarin Android - Wifisuggestions 不建议任何 wifi

Xamarin Android - Wifisuggestions does not suggest any wifi

大家好,我正在使用新的 wifisuggestionsstory,我已经在 Xamarin 中实现了这个,但我没有得到任何建议...,我没有网络设置,我的 android 设备。一旦我进入范围,它就应该连接到已定义的 wifi 路由器,但它既不建议也不连接。然而,当我查看我可能的 wifi 连接时,路由器存在但它不建议它......我使用以下示例代码(状态是 btw 成功所以它添加了建议):

var guestUsers = new WifiNetworkSuggestion.Builder()
    .SetSsid("GuestNetwork")
    .SetWpa2Passphrase("hunter2")
    .Build();

var secretEnterpriseNetwork = new WifiNetworkSuggestion.Builder()
    .SetSsid("Cyberdyne")
    .SetWpa2Passphrase(":D/-<")
    .Build();

var suggestions = new[] { guestUsers, secretEnterpriseNetwork };

var wifiManager = this.GetSystemService(Context.WifiService) as WifiManager;
var status = wifiManager.AddNetworkSuggestions(suggestions);

if (status == NetworkStatus.SuggestionsSuccess)
{
    // We added suggestions!
}

有人知道为什么 android Q 不提示连接到代码中定义的 wifi 路由器吗? 提前致谢

要回答这个问题,如果您手动断开与该网络的连接,则无法通过代码重新连接到此 wifi 盒子。因为被列入黑名单24小时...

文档是这样说的:

If the user uses the Wi-Fi picker to explicitly disconnect from one of the network suggestions when connected to it, then that network is blacklisted for 24 hours. During the blacklist period, that network will not be considered for auto-connection, even if the app removes and re-adds the network suggestion corresponding to the network.

男人真痛苦