无法为 Sim Profile android 11 添加 Passpoint 配置

问题描述

我在向 android 11 添加密码配置时遇到以下错误。 该代码适用于 android 8。

E/WifiNetworkSuggestionsManager: bad wifi suggestion from app: com.stl.hs2supportcheck
E/WifiService: Failed to add network suggestions

我正在使用以下代码添加密码配置

    Credential.SimCredential simCredential = new Credential.SimCredential();
    simCredential.setimsi("40405*");
    simCredential.setEapType(23);

    //Todo Missing Some Settings
    Credential c1 = new Credential();
    c1.setRealm(simProfile.getRealm());
    c1.setSimCredential(simCredential);

    //Set HomeSp : frindlyName and FQDN is mandatory
    HomeSp homeSp = new HomeSp();
    homeSp.setFriendlyName("WifiName");
    homeSp.setFqdn("test.com");


    PasspointConfiguration passpointConfiguration = new PasspointConfiguration();
    passpointConfiguration.setCredential(c1);
    passpointConfiguration.setHomeSp(homeSp);
    
    ArrayList<WifiNetworkSuggestion> suggestionList = new ArrayList<>();
    WifiNetworkSuggestion suggestion =
               new WifiNetworkSuggestion.Builder()
                      .setPasspointConfig(passpointConfiguration)
                      .setIsAppInteractionrequired(true) // Optional (Needs location permission)
                      .build();

            suggestionList.add(suggestion);
            wifiManager.addNetworkSuggestions(suggestionList);  //It returns fail

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)