Autoconnect

The host application can enable and disable Autoconnect using the setAutoconnectEnable method.

Enable Autoconnect:

WimanSDK.setAutoconnectEnable(this, true);

Disable Autoconnect:

WimanSDK.setAutoconnectEnable(this, false);

Check if Autoconnect is working correctly:

WimanSDK.isAutoconnectEnable(Context);

Preferences

Get the Autoconnect status (boolean)

WimanSDK.getPrefs(Context).autoConnectEnable

Check if Autoconnect is initialized (boolean)

WimanSDK.getPrefs(Context).initialized

Initialize

SDK Initialization

WimanSDK.initialize(Context, SDKkey);

SDK Initialization with Autoconnect start value (boolean)

WimanSDK.initialize(Context, SDKkey, defaultStart);

Opt-in Dialog

Shows Dialog:

WimanSDK.showOptin(activity);

Shows Dialog with start value (boolean):

WimanSDK.showOptin(activity, defaultStart);

Shows Dialog with a specific theme (ThemeStyle.LIGHT / ThemeStyle.DARK):

WimanSDK.showOptin(activity, themeStyle);

Shows Dialog with start value (boolean) and a specific theme:

WimanSDK.showOptin(activity, defaultStart, themeStyle);

Password protected Wi-Fi autoconnect

Download a country:

WimanSDK.downloadNetwork(Context,ISO CODE,WimanSdkNetworksListener);
  • ISO CODE
    country ISO 3166-1 alpha-2. Find out more here

  • WimanSdkNetworksListener
    It receives two different callbacks: "onSuccess" or "onError"

Wi-Fi networks nearby

Get Wi-Fi nearby (method #1):

WimanSDK.searchNetwork(Context,lat,lng,radius,WimanSdkNetwoksSearchListener)
  • lat
    latitude

  • lng
    longitude

  • radius
    in meter

  • WimanSdkNetworksListener
    It receives a list of Wiman networks

Get Wi-Fi nearby (method #2):

WimanSDK.searchNetwork(Context,bounds,WimanSdkNetwoksSearchListener)
  • bounds
    Google maps bounds

  • WimanSdkNetworksListener
    It receives a list of Wiman networks

Networks

Returns a list of all connected networks:

WimanSDK.getConnected(Context);

Events

The host application can receive Wiman SDK events.

In order to receive the events, the host application must use a listener with addEventsListener method.

Available events are the following:

  • onConnect
    to notify that the device has been connected to a WiFi network.

  • onError
    to notify that something went wrong

  • onDisconnect
    to notify that the device has been disconnected from the WiFi network previously connected thanks to Wiman SDK

WimanSDK.addEventsListener(new EventsListener() {

    @Override
    public void onConnect(String ssid, String bssid, int rssid, Location location) {
        ...
    }

    @Override
    public void onError(String ssid, String bssid, Availability codeError) {
        ...
    }

    @Override
    public void onDisconnect(long byteTot, long duration, String bssid) {
        ...
    }
});