WifiWizard2 icon indicating copy to clipboard operation
WifiWizard2 copied to clipboard

min version of Android supported

Open Sumbersss opened this issue 6 years ago • 4 comments

Prerequisites

Check all boxes if you have done the following:

  • [x] Checked that your issue isn't already filed: https://github.com/tripflex/wifiwizard2/issues
  • [x] Make sure you fill out the Issue Type below

Issue type

Select all that apply

  • [ ] Bug
  • [ ] Enhancement
  • [ ] Task
  • [x] Question
  • [ ] Other

Description

I have a small question, what is the min version of Android supporting this plugin ? On Android 5.0 the plugin doesn't work, that means i don't have the automagic demand to activate the wifi, so my application do not launch (because it's testing at the launch on which wifi i am connected)

Steps to Reproduce

Versions

wifizard2: 3.1.0 Android: 5.0

Additional Information

Sumbersss avatar Jan 30 '19 15:01 Sumbersss

@Sumbersss i'm honestly not sure, what errors or issues are you getting? Please provide specifics so we can look into this for you

tripflex avatar Feb 07 '19 20:02 tripflex

I can't see the error because it's at the early launch of my application but i can show you a part of the logic. Also, can I disable the auto ask for activation of the wifi ?

Here is the code.

$ionicPlatform.ready(function () {
            try {
                if (window.cordova) {
                    function successGetSSID(ssid) {
                        if (_.includes(ssid, DISPENSER_CONFIG.SSID_NAME))
                            live.init();
                        else {
                            checkAutoLogin();
                        }
                    }
                    wifiManager.getConnectedSSID().then(successGetSSID, checkAutoLogin);
                } else {
                    checkAutoLogin();
                }
            } catch (e) {
                console.error("error occured : ", e);
            }
        });

with getConnectedSSID

var getConnectedSSID = function() {
            return ($q(function(resolve, reject) {
                if (window.cordova) {
                    if (ionic.Platform.isAndroid()) {
                        WifiWizard2.requestPermission()
                            .then(function() {
                                WifiWizard2.getConnectedSSID()
                                    .then(function(ssid) {
                                        resolve(ssid);
                                    }, function(fail) {
                                        reject(fail);
                                    });
                            }, function(fail) {
                                reject();
                            })
                    }
                    else if (ionic.Platform.isIOS()) {
                        WifiWizard2.getConnectedSSID()
                            .then(function(ssid) {
                                resolve(ssid);
                            }, function(fail) {
                                reject(fail);
                            });
                    }
                }
                else
                    reject();
            }));
        };

Sumbersss avatar Feb 18 '19 10:02 Sumbersss

First of all, have you ever tried to code properly ??? Wtf is this shit

Check the code after 2min of thinking like a normal human being

var getConnectedSSID = function () {
    return $q(function (resolve, reject) {
        if (!window.cordova) {
            reject();
        }

        function connectWithWizard() {
            WifiWizard2.getConnectedSSID().then(onSuccess, onReject);
        }

        function onSuccess(ssid) {
            resolve(ssid);
        }

        function onReject(fail) {
            reject(fail);
        }

        if (ionic.Platform.isAndroid()) {
            WifiWizard2.requestPermission().then(connectWithWizard, onReject);
        } else if (ionic.Platform.isIOS()) {
            connectWithWizard();
        }

    });
};

For the early launch -> chrome://inspect

TheSegfault avatar May 23 '19 11:05 TheSegfault

Under Android versions below 6.0 your WifiWizard2.requestPermission() will not return a result (when I tried it, the promise kept being stuck on 'pending' indefinitely).

The simple reason for this is that below Android 6 there were no permission dialogues at all. You can mitigate this by only making this call after checking the Android version is 6 or above.

Not sure if this should be considered as a bug worth reporting.

astinka avatar Aug 04 '20 12:08 astinka