# Wi-Fi provisioning over BLE for IoT apps: a practical guide
URL: https://alexmitrovic.com/blog/wifi-provisioning-over-ble
Last updated: 2026-11-29

> 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.

[Wi-Fi & IoT](https://alexmitrovic.com/blog#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.

By [Alex Mitrovic](https://alexmitrovic.com/about)Published 29 November 20263 min read

## On this page

1. [BLE provisioning vs SoftAP](https://alexmitrovic.com/blog/wifi-provisioning-over-ble#methods)
2. [The flow that works](https://alexmitrovic.com/blog/wifi-provisioning-over-ble#flow)
3. [On ESP32: unified provisioning](https://alexmitrovic.com/blog/wifi-provisioning-over-ble#esp32)
4. [Errors users can act on](https://alexmitrovic.com/blog/wifi-provisioning-over-ble#errors)
5. [After setup](https://alexmitrovic.com/blog/wifi-provisioning-over-ble#after)
6. [FAQ](https://alexmitrovic.com/blog/wifi-provisioning-over-ble#faq)
7. [Sources](https://alexmitrovic.com/blog/wifi-provisioning-over-ble#sources)

**Stuck on this in a real app?** I fix it on real phones, usually within a week.

[Book a free call](https://alexmitrovic.com/contact)

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](https://alexmitrovic.com/work/esp32-iot-device), and the same pattern applies to most Wi-Fi products.

## BLE provisioning vs SoftAP

|  | BLE provisioning | SoftAP provisioning
| How it works | App sends credentials to the device over a BLE connection | Phone joins a temporary Wi-Fi network from the device and sends credentials over it
| Phone's own network | Stays connected the whole time | Disconnected during setup
| Android | BLE permissions only | `WifiNetworkSpecifier` + `requestNetwork`; the phone may route traffic away from a network without internet
| iOS | CoreBluetooth | `NEHotspotConfiguration` (needs an entitlement) and the local network permission
| Needs on the device | BLE radio (most Wi-Fi chips have it) | Only Wi-Fi
| Typical feel | Smooth, fewer prompts | More 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.

```
→ prov.scan()
← networks: HomeNet (-48, WPA2), HomeNet-5G (5 GHz, not supported), Guest (-71, open)
→ prov.config(ssid=HomeNet, pass=••••••••)
← state=CONNECTING
← state=AUTHENTICATED
← state=GOT_IP 192.168.1.42
← state=CLOUD_CONNECTED
// only now: “Your device is online”
```

## 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 happened | What 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 setup | Reconnect 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](https://alexmitrovic.com/blog/ble-vs-wifi-vs-mqtt-iot-app).

## 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

- [Espressif: Wi-Fi Provisioning (ESP-IDF)](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/provisioning/wifi_provisioning.html)
- [Android Developers: WifiNetworkSpecifier](https://developer.android.com/reference/android/net/wifi/WifiNetworkSpecifier)
- [Apple Developer: NEHotspotConfiguration](https://developer.apple.com/documentation/networkextension/nehotspotconfiguration)
- [Android Developers: Network service discovery](https://developer.android.com/develop/connectivity/wifi/use-nsd)

**Written by Alex Mitrovic**, an Android and iOS developer who builds reliable apps for Bluetooth and IoT devices and tests every fix on real phones. If your app has this problem on phones you can't pin down, the [BLE reliability audit](https://alexmitrovic.com/services/ble-reliability-audit) finds out why in about a week. [About me](https://alexmitrovic.com/about) · [LinkedIn](https://www.linkedin.com/in/aleksmitro98/)

## Read next

[**Enclosure****ESP32-S3****App** Case study### ESP32-S3 device, PCB to appA connected device built end to end: PCB, enclosure, ESP32-S3 firmware in C/C++ and a Kotlin Multiplatform app with BLE and Wi-Fi setup.](https://alexmitrovic.com/work/esp32-iot-device)

[Article### BLE vs Wi-Fi vs MQTT for an IoT app: which link to use, and when to combine themBLE, local Wi-Fi or MQTT through the cloud for an IoT app? Range, speed, power, setup and offline use compared, and the combinations that work.](https://alexmitrovic.com/blog/ble-vs-wifi-vs-mqtt-iot-app)

[**App****BLE setup****On the home Wi-Fi** Service### IoT app developmentAndroid and iOS apps for IoT devices beyond Bluetooth: Wi-Fi provisioning, local control, MQTT and cloud, USB serial, and one device state.](https://alexmitrovic.com/services/iot-app-development)

## 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](https://alexmitrovic.com/contact)

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