cordova-hotspot-plugin
cordova-hotspot-plugin copied to clipboard
Getting / Not getting available networks list randomly
This is my code:
import {Hotspot, HotspotNetwork, HotspotNetworkConfig} from '@ionic-native/hotspot';
constructor(public navCtrl: NavController, private hotspot: Hotspot) {
this.platform.ready().then(() => {
setInterval(() => {
this.scanNetworks();
this.scans = [];
this.scans.push({
"networksData": this.networksData,
});
}, 1000);
});
}
public scanNetworks() {
this.hotspot.scanWifi().then((networks: Array<HotspotNetwork>) => {
alert(networks)
this.networksData = networks;
}).catch((e) => {
alert("ERROR: " + e.message);
});;
}
Sometimes, the output of alert
is absolutely as I'd expect it to be; i.e. I get a list of all the available SSID, BSSID, and RSSI. But other times (which is most of the times), I don't get absolutely anything in response. It's not falling into the error block because every time scanWifi
function is a success, but only a handful of times it returns data.
Has anyone experienced this issue before? Please note that I didn't have this issue up until a few days ago.
I am using:
"@ionic-native/hotspot": "^4.8.0",
"cordova-plugin-hotspot": "1.2.10",
Any help will be much appreciated. Thanks.
Solved it by ditching https://ionicframework.com/docs/native/hotspot and using https://github.com/tripflex/WifiWizard2
Solved it by ditching https://ionicframework.com/docs/native/hotspot and using https://github.com/tripflex/WifiWizard2
How can i use it in ionic v4.