阿里云
发表主题 回复主题
  • 739阅读
  • 1回复

[交流乐园]wifi连接 android三星7.0版本WifiManager.addNetwork返回-1

级别: 新人
发帖
2
云币
8
在功能模块中开发wifi连接,在点击连接wifi的时候,6.0版本能正常连接,但是在三星7.0版本中点击连接之后不能连接,并且返回为-1 ,请教各路大神,什么原因造成的! #Z.JOwi  
public WifiConfiguration CreateWifiInfo(String SSID, String Password, int Type) ,t[D1KZt  
    { w.3R1}R  
        WifiConfiguration config = new WifiConfiguration(); iO@wqbg$6  
        config.allowedAuthAlgorithms.clear(); w"e2}iE7  
        config.allowedGroupCiphers.clear(); hi=U  
        config.allowedKeyManagement.clear(); ooAZ,l=8  
        config.allowedPairwiseCiphers.clear(); M{H&5 9v  
        config.allowedProtocols.clear(); ) ad-s  
        config.SSID = "\"" + SSID + "\""; MnQ_]c C  
Fzu{,b  
        WifiConfiguration tempConfig = this.IsExsits(SSID); yx-"YV}5  
        if(tempConfig != null) { /?GBp[(0  
            mWifiManager.removeNetwork(tempConfig.networkId);  l gC  
        } P TP2QAt  
mvw:E_  
        if(Type == 1) //WIFICIPHER_NOPASS /<C=9?Ok  
        { BpCSf.zZ  
            config.wepKeys[0] = ""; OTm`i>rB  
            config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE); h(L5MZs  
            config.wepTxKeyIndex = 0; E=E<l?ob  
        } /[s$A?  
        if(Type == 2) //WIFICIPHER_WEP $CmTsnR1#y  
        { ox6rR  
            config.hiddenSSID = true; tFwlx3  
            config.wepKeys[0]= "\""+Password+"\""; p5KNqqZZ  
            config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED); B]vj1m`9  
            config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP); qha<.Ro  
            config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP); by<2hLB9Q  
            config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40); 8vo} .JIl  
            config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104); v^tKT&  
            config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE); *.RVH<W=8  
            config.wepTxKeyIndex = 0; `FwAlYJK  
        } U*@_T3N  
        if(Type == 3) //WIFICIPHER_WPA a|NU)mgEI  
        { zN1;v6;  
            config.preSharedKey = "\""+Password+"\""; =FnZkJ  
            config.hiddenSSID = true; Ba6xkEd  
            config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN); D\R^*k@V  
            config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP); .tNB07=7  
            config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK); m%&B4E#3T  
            config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP); }#J}8.  
            //config.allowedProtocols.set(WifiConfiguration.Protocol.WPA); msylb~^  
            config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP); Oq5k4  
            config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP); s<b7/;w'  
            config.status = WifiConfiguration.Status.ENABLED; #k)\e;,X  
        } E`|qFG<  
        return config; EMG*8HRI>r  
    } 0h#M)Ft  
KfNXX>'  
public void addNetwork(WifiConfiguration wcg) { 5b,98Q  
        int wcgID = mWifiManager.addNetwork(wcg); \4k*Zk  
        boolean b =  mWifiManager.enableNetwork(wcgID, true); ,)1e+EnV&  
        Log.e("addNetwork","a--" + wcgID); b G)MG0<TT  
        Log.e("addNetwork","b--" + b); vvxj{fxb)  
    }
关键词: android
级别: 新人
发帖
2
云币
8
只看该作者 沙发  发表于: 09-10
回 楼主asshadow的帖子
难道没人遇到过吗?
发表主题 回复主题
« 返回列表上一主题下一主题

限100 字节
批量上传需要先选择文件,再选择上传
 
验证问题: 72 - 14 = ?
上一个 下一个