An android library to effortlessly connect to available WiFi networks
Check the demo app for this library here.
WifiConnectionManager#abort()
method. This should be called when your app wants to stop scanning or connecting to WiFi.initialStickyBroadcast
, so if Wifi is disabled again by the user explicitly, abort()
is called. This will remove all the listeners and the callbacks would no longer be received.WifiConnectionManager.setBindingEnabled(true)
can be called that would ensure that the app uses the network (to which the device would connect to when WifiConnectionManager#connectToAvailableSSID(String SSID, WifiConnectionManager.ConnectionStateChangedListener listener)
is called) to route traffic irrespective of whether it provides internet connectivity.WifiConnectionManager#connectToAvailableSSID(List<String> SSIDs, WifiConnectionManager.ConnectionStateChangedListener listener)
accepts a list of SSIDs and can connect to an available network with strongest singal that has an SSID among SSIDs.WifiConnectionManager#checkBoundNetworkConnectivity()
that enabled verifying and switching to using WiFi network to which app is bound currently for sending network traffic for whole device. It makes it as active network if network connectivity is available in case now Captive Portal login has been performed, otherwise it switches from using currently bound network.AdvancedConnectionState
that provides callback at different logical points in the process of connecting to a network.ConnectionStateListener#onConnectionEstablished()
or an error occurs ConnectionStateListener#onConnectionError()
.connectToAvailableSSID()
Make your project-level build.gradle has jcenter() under repositories block. Your build.gradle should look like:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
}
}
Gradle: compile 'com.intentfilter:android-wificonnect:0.1.2'
Add as android-wificonnect as dependency inside app module level build.gradle under dependencies block. Your app level build.gradle should look like:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.intentfilter:android-wificonnect:0.1.2'
}
Note: