How to connect wifi?


#5

There is one error in above code:
In your connectToWifi method 2nd parameter is wrong. It should be like this:

       console.log("password",Password.title,SSID);
       //2nd parameter should be Password.title
       this.hotspot.connectToWifi(SSID, Password.title) 
          .then((data) => {
                 console.log(".........hotspot..........",data);
            }, (error) => {
                 console.log(".........hotspot..........",error);
            });

#6

I try it .But it connected to pervious wifi device
can you help me


#7

are you getting any error?


#8

I am tried it now
But it connect to the pervious device may know why it happening


#9

I try to do disable the previous network but i try to connect means this shows like this message


#10

Can you explain the scenario what you did and what exactly is happening?
Because log message shows that first time your connection to wifi network “Connecting…” was successful.


#11

yes, actually the first time I am trying to connect.But it connects to previous wifi device.
And show message like this

“connection was successfull”

Second time disable the previous wifi device(wifi setting/Forgot network) and trying to connect to (connecting…) wifi device but it show error message

“connection was not successful”


#12

Oh…sorry. There is already one ongoing issue on this plugin: https://github.com/hypery2k/cordova-hotspot-plugin/issues/57

Many people are facing this kind of issue.

Someone suggested one workaround on that issue, try and see if it works for you.

       console.log("password",Password.title,SSID);
       this.hotspot.removeWifiNetwork(SSID).then( () => {
            this.hotspot.connectToWifi(SSID, Password.title) 
                .then((data) => {
                      console.log(".........hotspot..........",data);
                 }, (error) => {
                      console.log(".........hotspot..........",error);
                 });
       }, () => {
       });

#13

ok i am trying @Ankit_Makwana


#14

No , again showing like that error


#15

Ok…I will try myself and see if there is some issue.
I will reply back if I’ll find anything useful.


#16

ok @Ankit_Makwana i am also trying


#17

you get any solution ankit makwana


#18

Nope…and that guy who made the plugin has discontinued the project.


#19

Maybe you can try WifiWizard:

Never tried it and I noticed some issues while reading about it but someone managed it to work:

It does contains methods to connect to a WiFi net (even if at a first glance I can’t figure out how to pass the password as an argument… maybe you have to study it a bit):


#20

ok @Ankit_Makwana
I will try some other plugin


#21

ok i will try @AllartSoftworks


#22

it’s work for me @AllartSoftworks


#23

Continuing the discussion from How to connect wifi?:

is it work for both android and ios ? please let me know if you have any solution for scan wifi list in ios as well as andorid. help me


#24

i am also interested in using this plugin. But how can i install a phonegap plugin for ionic?