不能与采用Android棒棒糖无线连接其它Android设备 [英] Can not connect another android device with wifi with android lollipop

查看:142
本文介绍了不能与采用Android棒棒糖无线连接其它Android设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  

您好,我试图通过wifi连接两个Android设备。在这里,人们
  器件提供热点和其他设备将连接可用
  无线上网。在这里我用以下code与无线连接


  mainWifi =(WifiManager)device_list.this。 getSystemService(Context.WIFI_SERVICE);
mainWifi.setWifiEnabled(真);
mainWifi.startScan();
 WifiConfiguration wifiConfig =新WifiConfiguration();
        wifiConfig.SSID = sr.SSID;
        wifiConfig.status = WifiConfiguration.Status.ENABLED;
        wifiConfig.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
        wifiConfig.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
        wifiConfig.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
        wifiConfig.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
        wifiConfig.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
        wifiConfig.allowedProtocols.set(WifiConfiguration.Protocol.RSN);
        wifiConfig.priority = 40;
        NETID = mainWifi.addNetwork(wifiConfig);            mainWifi.disconnect();
            mainWifi.enableNetwork(NETID,真);
            mainWifi.reconnect();


  

以上code在低版本的工作完美,我有问题
  与Android棒棒糖。与Android棒棒糖,我不能接
  无线网络,它与previous 1回退,所以我在等待完美
  为解决这个问题。谢谢你。



解决方案

我有同样的问题,我通过更新API解决了这个问题。
每一个操作系统内核设计器提供的API,用于应用程序的程序员,那变化不时。


  

https://developer.android.com/about/versions/android- 5.0.html
   https://developer.android.com/about/versions/android-5.0 -changes.html


这可能会帮助您还。

Hello, I am trying to connect two android device through wifi. here one device was providing hotspot and another device will connect available wifi. In here am using following code to connect with wifi

mainWifi = (WifiManager)device_list.this. getSystemService(Context.WIFI_SERVICE);
mainWifi.setWifiEnabled(true);
mainWifi.startScan();
 WifiConfiguration wifiConfig = new WifiConfiguration();




        wifiConfig.SSID = sr.SSID;
        wifiConfig.status = WifiConfiguration.Status.ENABLED;


        wifiConfig.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
        wifiConfig.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
        wifiConfig.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
        wifiConfig.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
        wifiConfig.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
        wifiConfig.allowedProtocols.set(WifiConfiguration.Protocol.RSN);
        wifiConfig.priority = 40;


        netId = mainWifi.addNetwork(wifiConfig);

            mainWifi.disconnect();
            mainWifi.enableNetwork(netId, true);
            mainWifi.reconnect();

The above code is working perfect in lower version and i had problem with android lollipop. with android lollipop i can not connect with wifi, it fallback with previous one, so i am waiting for perfect solution for this issue. thank you.

解决方案

I was having the same problem, I fixed this problem by updating the API. Every Operating system kernel Designer provides API, for Application programmers, that changes from time to time.

https://developer.android.com/about/versions/android-5.0.html https://developer.android.com/about/versions/android-5.0-changes.html

May these will help for you also.

这篇关于不能与采用Android棒棒糖无线连接其它Android设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆