Alex MitrovicBLE & IoT app developer, Android and iOS

Wi-Fi & IoT

Wi-Fi provisioning over BLE: getting IoT devices online without losing users

Getting an IoT device onto Wi-Fi from an Android or iOS app: BLE provisioning vs SoftAP, ESP32 provisioning, confirmation and the errors to handle.

Short answer

For most IoT devices, provisioning Wi-Fi over BLE is the smoother option: the phone stays on its own network, the device scans for Wi-Fi networks and sends the list over BLE, the app sends the chosen network's credentials encrypted, and the device reports each step (connecting, got IP, cloud reached) back over BLE so the app can confirm success or show the exact reason it failed.

Key takeaways

  • BLE provisioning keeps the phone on its normal network; SoftAP makes the phone join the device's network, which phones resist.
  • Let the device scan for Wi-Fi and send the list: it sees what it can actually join, and the phone needs no extra permissions.
  • Never send credentials in plain text: use an encrypted session with proof of possession.
  • Don't say “done” until the device confirms it got an IP address, ideally that it reached the cloud.
  • Map each failure to a message the user can act on: wrong password, network not found, 5 GHz only.

Setup is where connected products lose people. The user has the device in one hand, the phone in the other and a Wi-Fi password on a sticker behind the router. Every extra screen, unclear error or “try again” is a return to the store. I've built this flow for my own ESP32-S3 device, and the same pattern applies to most Wi-Fi products.

BLE provisioning vs SoftAP

BLE provisioningSoftAP provisioning
How it worksApp sends credentials to the device over a BLE connectionPhone joins a temporary Wi-Fi network from the device and sends credentials over it
Phone's own networkStays connected the whole timeDisconnected during setup
AndroidBLE permissions onlyWifiNetworkSpecifier + requestNetwork; the phone may route traffic away from a network without internet
iOSCoreBluetoothNEHotspotConfiguration (needs an entitlement) and the local network permission
Needs on the deviceBLE radio (most Wi-Fi chips have it)Only Wi-Fi
Typical feelSmooth, fewer promptsMore prompts, more “no internet” warnings

If the chip has BLE, BLE provisioning is usually the better experience. SoftAP is a good fallback for Wi-Fi-only chips, and sometimes worth offering as a second path.

The flow that works

  1. Find the device over BLE by its service UUID, ideally with a setup code or QR code on the device to pick the right one.
  2. Open a secure session. Credentials must never travel in plain text. Use an encrypted session with proof of possession (a code printed on the device or shown on its display).
  3. Ask the device to scan for Wi-Fi. It sends back the networks it can see, with signal strength and security type. This shows only networks the device can actually reach (often 2.4 GHz only), and the phone needs no Wi-Fi scanning permission.
  4. Send the chosen network and password. Offer the phone's current network first; let users type a hidden SSID.
  5. Follow the device's progress through notifications: connecting, authenticated, got IP, cloud reached.
  6. Confirm success only when the device says it's online. Then hand over to local or cloud control.

On ESP32: unified provisioning

Espressif's ESP-IDF has a provisioning component that does most of this on the device side: BLE or SoftAP transport, a secure session (security 1 with proof of possession, or security 2 based on SRP6a), Wi-Fi scanning and status reporting. Espressif also publishes Android and iOS provisioning libraries and example apps. On my own device I used BLE onboarding and Wi-Fi provisioning over BLE. Say whether you used ESP-IDF's provisioning component or your own GATT protocol, and why.

Errors users can act on

What happenedWhat to tell the user
Authentication failed“The Wi-Fi password didn't work. Check it and try again.” (Keep the network selected.)
Network not found“The device can't see that network. Move it closer to the router, or check it's a 2.4 GHz network.”
Got no IP address“The device joined the network but didn't get an address. Restart the router, or check for MAC filtering.”
No cloud connection“The device is online but can't reach our servers. Check whether the network blocks it (e.g. a guest network).”
BLE dropped during setupReconnect on its own and ask the device for its state before asking the user anything.

After setup

The app usually switches from BLE to the network: finding the device on the LAN with mDNS (Bonjour on iOS, NSD on Android) and talking to it locally, or going through the cloud with MQTT. On iOS 14+, local network access needs its own permission prompt, with a usage description in Info.plist. Keep BLE available for re-provisioning when the user changes routers. More on choosing links in BLE vs Wi-Fi vs MQTT.

FAQ

Is BLE or SoftAP better for Wi-Fi provisioning?

BLE provisioning is usually smoother: the phone keeps its own internet connection and there are fewer system prompts. SoftAP works for Wi-Fi-only devices but makes the phone join a network without internet, which both Android and iOS push back on.

Why can't my IoT device see my 5 GHz Wi-Fi?

Many IoT Wi-Fi chips support only 2.4 GHz. Letting the device scan and send its list of networks avoids offering networks it can't join, and the app can explain the 2.4 GHz requirement when the user's network is 5 GHz only.

Is it safe to send Wi-Fi passwords over BLE?

Only over an encrypted session. Use the provisioning protocol's secure session (for example ESP-IDF's security 1 or 2 with proof of possession) or BLE encryption plus application-level encryption; never write credentials to a characteristic in plain text.

Sources

Seeing this in your own app?

Send me the phone models and what the logs say. On a short call I'll tell you where I'd look first.

Book a free call

Free · NDA on request · reply within 1–2 working days