Search code examples
cordovawifiwireless

Does Phonegap's Connection API *actively* scan for wireless networks?


Apologies if this is a duplicate, but I haven't found this info anywhere.

Phonegap has a Connection API as detailed here. This checks information on available networks. My question is does it actively check/scan for wireless networks, or is it simply using the most recent wireless network availability information that the phone has picked up?

For my project I may need to scan for wireless networks more frequently than normal. If the Connection API merely uses the information the phone already has, then it is not useful to me. If, however, it starts an active scan, then it would be very useful to me.

Alternately, I realise there may be plugins available on Phonegap to do this.


Solution

  • After reading the documentation and looking at the examples, that API doesn't scan for anything. The only exposed attribute it has is the connection.type variable which returns predetermined constants based upon the connection that the phone already has.

    As well, Javascript and HTML may not be best-suited for doing something like you described. You may have to write native code for something low-level like changing or scanning for networks that the device detects.