How to create android app to connect to specific Wifi SSID and password

I m working on the capacitor based ionic project for to create the android app.
There, thing is, to connect to specific wifi network, that I have the SSID and password. I want to connect to that wifi in the android app.
i tried this code,
import { Component, OnInit } from ‘@angular/core’;
import { Network } from ‘@capacitor/network’;

@Component({
selector: ‘app-wifi’,
templateUrl: ‘./wifi.component.html’,
styleUrls: [‘./wifi.component.css’]
})
export class WifiComponent implements OnInit {

ssid: string;
password: string;

constructor() { }

ngOnInit() { }

connectToWifi() {
try {
await Network.connect({
ssid: this.ssid,
password: this.password
});
} catch (error) {
console.log(‘Failed to connect to Wi-Fi network’);
console.log(error);
}
}

}

But the issue is, the plugin @capacitor/network does not have connect() function. I don’t know the recent version has removed this.
Can anyone help me which plugin has the function to connect to wifi with giving SSID and password?
If you have any other way to this issue please let me know.

Thanks in advance

1 Like

Hello @AbdulRahman577 , I am also wondering the same thing. Did you find any workaround by any chance?

No @alexasilock So Far. I moved to flutter by the way :wink:

1 Like