Wifi module that connects to Access point

I want to provision my device using mobile app(Android and IOS).
My device has capability of providing an Access point.
Initially the device does not have internet connectivity.
In order to achieve this, I want to exchange the SSID and Password of my WIFI(With internet connectivity) over XMLHttpRequest with my device using my phone app.

Can anyone suggest how to achieve this? I am really new to flutter. Looking forward to learn more on this topic. Thank you.

The way I have achieved this in a project I’ve been working on is by letting the device scan for WiFi networks prior to opening its access point and keep the discovered networks in memory. The Flutter app would then prompt the user to connect the phone it’s running on to the device’s AP while sending ping commands that the device is programmed to respond to (You can use the udp package for this purpose. If you’re using modern versions of Flutter and Dart, there’s a fork that provides null safety. If you prefer HTTP requests there’s [this package] (EDIT: I had to remove the link as I wasn’t allowed to post more than two links, but you can search for “http” on pub.dev), though I haven’t used that one personally. UDP does seem to be the better choice for ping commands, though, thanks to its connectionless nature.).

If a ping response is received, it would request the list of networks from the device and display it to the user, who would then select the desired network and enter its password, which the app would then transfer to the device.

Since no communication between the app and the device is possible while the device is attempting to connect to the desired network, the device would have an LED that would indicate whether the connection has succeeded or failed and the app would instruct the user to watch said LED and retry the connection if it failed, or connect their phone to the desired WiFi network so that the setup could be completed.

Regards, Adrian.

Thank you for your detailed response. Could you please let me know about the package(name) you are using in order to connect flutter app with the Accesspoint?

Hello @Anjan_Dudda I have recently done something similiar. There are two ways you can achieve this:

  1. Using BLE

  2. Using SoftAP

  3. Using BLE
    Using Bluetooth, there are is a lot of help available, you can check this plugin:

  1. Using SoftAP
    This has relatively less information and no official package. But I have used this github

You can check out their example code, the following will also be helpful:

 void startProvisioning() async {
 await WiFiForIoTPlugin.forceWifiUsage(true); // I had to add this because sending WiFi credentials was failing with unable to reach exception.
  Provisioning? prov;
     prov = await softApService.startProvisioning("", pop.value); // This will be the gatewayIP once your device is connected to the softAP device.
    ConnectionStatus? status = await prov?.getStatus();
    log("PROV STATUS  STATE ==== ${status?.state} IP ==== ${status?.ip} FAILED REASON ==== ${status?.failedReason} ");
    log("SEND WIFI CONFIG");
    bool? response =
        await prov?.sendWifiConfig(ssid: ssid.value, password: password.value);
    // sending wifi config to the softAP device
    log("SEND WIFI CONFIG STATUS $response");
    bool? applyResponse = await prov?.applyWifiConfig();
    log("APPLY WIFI CONFIG STATUS $applyResponse");

    await Future.delayed(const Duration(seconds: 10));
    ConnectionStatus? connectionStatus = await prov?.getStatus();
    await WiFiForIoTPlugin.forceWifiUsage(false);
    await WiFiForIoTPlugin.disconnect(); // disconnect mobile from softAP device
    await Future.delayed(const Duration(seconds: 2));


class SoftAPService {

  Future<Security1> getSecurity1(String pop) async {
    print("POP VALUE ===== $pop");
    var security1 = Security1(pop: pop, verbose: true);
    return security1;

  Future<Provisioning> startProvisioning(String hostname, String pop) async {
    print("HOSTNAME ===== $hostname");
    print("POP VALUE ===== $pop");
    Provisioning prov = Provisioning(
      transport: TransportHTTP(hostname),
      security: Security1(
        pop: pop,
        verbose: true,
    var success = await prov.establishSession();
    if (!success) {
      throw Exception('Error establishSession');
    return prov;

Yet to explore if this will work or be allowed on the iOS platform.

Thank you. I tried to use the package. It looks like is more ESP specific. My hardware module do not contain ESP. And also the wifi_iot package I am facing issues, as my phone target version is API level 30. Could you please share the API level in which you got the above code working?

I got it working on the below settings:

    minSdkVersion 18
    targetSdkVersion 30

Is there any communication that is specific to only ESP32? Because when I try to connect to another network, the https://github.com/omert08/esp_softap_provisioning is not showing the wifi settings screens. Just checking with you, should this package be used only with ESP hardware?

Thank you for the response. Unfortunately my device does not have capabilities that you have mentioned.

1 Like