void connectToNetwork(string, string)

Attempts a connection to a specific WiFi network.

Parameters

Name Description
ssid string
The SSID of the network to connect to.
psk string
The password to use when authenticating to the network. Pass an empty string for open networks.

Remarks

When a connection attempt succeeds, the onNetworkStatusChange callback will fire.

If the network is saved, it overwrites the credentials. If it is not saved, it will create a new saved network.

This function will not use saved credentials; if that is desired, use connectToSavedNetwork() instead.

Return

Returns nothing.

Examples


KioWareUtils.connectToNetwork('MyNetwork', 'mypassword');
function onNetworkStatusChange (noConnectivity, failover, type, reason) {
   if (type == 1) {
       if (noConnectivity) 
           alert('Disconnected from wifi!');
       else
           alert('Successfully connected to ' + KioWareUtils.getCurrentNetwork());
   }         
}
    

Requirements

KioWare for Android version 3.14 or greater.