Пример #1
0
 public static void disconnect() {
   List<WifiConfiguration> list = wifiManager.getConfiguredNetworks();
   for (WifiConfiguration i : list) {
     if (i.SSID.equals(FirstSettings_two.first_ssid)) {
       WifiConfiguration conf = new WifiConfiguration();
       conf.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
       conf.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
       wifiManager.disconnect();
       break;
     }
   }
 }
Пример #2
0
  public static void reconnect1() {
    try {
      List<WifiConfiguration> list = wifiManager.getConfiguredNetworks();
      for (WifiConfiguration i : list) {
        if (i.SSID.equals(FirstSettings_two.first_ssid)) {
          wifiManager.enableNetwork(i.networkId, true);
          wifiManager.reconnect();

          break;
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    ;
  }
Пример #3
0
 public void reconnect5() {
   try {
     List<WifiConfiguration> list = wifiManager.getConfiguredNetworks();
     for (WifiConfiguration i : list) {
       if (i.SSID.equals(FirstSettings_two.first_ssid)) {
         wifiManager.enableNetwork(i.networkId, true);
         wifiManager.reconnect();
         File_Video downloadFile_video = new File_Video();
         downloadFile_video.execute(BroadcastNewSms.filepath);
         break;
       }
     }
   } catch (Exception e) {
     Toast.makeText(getApplicationContext(), e.getMessage().toString(), Toast.LENGTH_LONG).show();
   }
   ;
 }