'WifiWizard 2 ERROR_ADDING_NETWORK

I need some help. I try to develop an app which is setting up the wifi connection on an android device. I try to use WifiWizard2 with this.wifiWizard2.connect(ssid, bindAll, password, algorithm, isHiddenSSID) but when i try the app on an Device (Android 12) i only get the Error: ERROR_ADDING_NETWORK.

Here is the code I use, i hope you can help me:

import { Component } from '@angular/core';


declare var WifiWizard2: any;


@Component({
  selector: 'app-home',
  templateUrl: 'home.page.html',
  styleUrls: ['home.page.scss'],
  
})
export class HomePage {
  ssid = "ubntPOS";
  password = "6545A-UAPACL";
  info_txt = "";

  async getNetworks() {
    this.info_txt = "test123";
    try {
      await WifiWizard2.timeout(4000);
      await WifiWizard2.connect(this.ssid,true,this.password,'WEP',false);
      this.info_txt = "";
    } catch (error) {
      this.info_txt = error;
    }
  }
}

For example:

WifiWizard2.scan();

does work properly and list all networks nearby.

Thank you!



Solution 1:[1]

I got the solution-

When I degraded my targetSdkVersion the everything is working fine. The targetSdkVersion or api-level < = 29.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nitin Yadav