The plugin was developed with Flutter version 3.24.5, it contains a sample app that installs a WPA2 certificate. To perform a test it is necessary to enter correct keys. The integration and configuration include a first phase on the Flutter project and a second phase in the individual iOS and Android projects
Flutter installation
Run this command:
With Flutter:
$ flutter pub add c4w_wifi_sdk_flutter
This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):
dependencies:
c4w_wifi_sdk_flutter: ^1.0.0
Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.
In order to connect your application with your Cloud4Wi account, you need to provide SDK with clientKey and clientSecret credentials.
Credentials may be provided to SDK either via configuration property or at runtime. Add two records into your application's string.xml as in examples below:
To track the last seen date of the customer and to keep always updated the remote push notification token (if applicable) it is necessary to call the method every time the app starts
import com.cloud4wi.sdk.wifi.Cloud4WiSDKWiFi
...
val mobileSDK: Cloud4WiSDKWiFi = Cloud4WiSDKWiFi(applicationContext)
mobileSDK.initC4w()
...
iOS installation
Required Capabilities
In order to use the SDK you have to add the 'Hotspot Configuration' capability to your application
Configuration
In order to connect SDK to your Cloud4Wi account, you have to specify 'clientKey' and 'clientSecret'.
You can set them in your App Info.plist file by adding two following keys:
To track the last seen date of the customer and to keep always updated the remote push notification token (if applicable) it is necessary to call the method every time the app starts
func initC4w(pushToken: String)
you can put it into didFinishLaunchingWithOptions for example
In following code example we will create new customer in the API and then install WPA2-Enterprise Wi-Fi profile . After that when customer will be in range of Wi-Fi network with specified SSID - his device will connect automatically.
This example represents following use-case.
MobileSDK configuration. Setting API client credentials.
Read list of organization policies from API.
Creating new customer in API.
Verifying customer credentials in API.
Creation of WPA2-Enterprise Wi-Fi profile on device for test user to connect to test SSID.