hypery2k / cordova-hotspot-plugin

A Cordova plugin for managing HotSpot networks on Android
MIT License
37 stars 50 forks source link

Getting / Not getting available networks list randomly #103

Open faizan1990 opened 5 years ago

faizan1990 commented 5 years ago

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.

faizan1990 commented 5 years ago

Solved it by ditching https://ionicframework.com/docs/native/hotspot and using https://github.com/tripflex/WifiWizard2

vksingh225 commented 4 years ago

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.