BLE Provisioning for IoT Devices via Mobile App
Developers often look for a reliable way to transfer Wi-Fi credentials to a device without a screen. Bluetooth Low Energy provisioning is the answer. It does not require switching the phone's network, is 10 times more reliable than SmartConfig (especially in noisy environments), and is 3 times faster than manual Wi-Fi configuration. Additionally, it does not depend on router settings. We help you integrate this mechanism into your app—from prototype to store publication. Our team has over 7 years of experience in BLE and IoT, with more than 50 provisioning projects delivered. We will assess your project within two days. According to Bluetooth SIG, BLE achieves approximately 95% successful connections with proper implementation.
Why BLE Provisioning is the Best Choice for IoT
BLE consumes less power than Wi-Fi Direct and works on all modern smartphones. For chips like ESP32, nRF52, and Nordic, it is the preferred method. In provisioning mode, the device advertises a BLE service, the app connects as a GATT client and writes the configuration. After success, the device connects to Wi-Fi and stops advertising. BLE provisioning is 10 times more reliable than SmartConfig, especially in noisy environments. Implementation cost typically starts from $5,000 for ESPProvision integration, and logistics savings can be up to 30% due to reduced manual setup. Certified BLE developers ensure a guaranteed reliable connection.
GATT Architecture for Provisioning
The device in provisioning mode advertises a BLE service. The mobile app connects as a GATT client and writes data to the service characteristics. Standard schema for ESP-IDF:
- Service UUID:
021a9004-0382-4aba-aa36-ec4d15d65e0e (Espressif Provisioning)
- Configuration characteristic: write (SSID, password, auth mode)
- Status characteristic: notify (result of device connecting to network)
After writing credentials, the device attempts to connect to Wi-Fi and notifies the phone via the notify characteristic of success or failure.
The provisioning process can be broken into steps:
- Scan for BLE devices with the provisioning service.
- Connect and MTU negotiation (request 512 bytes).
- Read/write characteristics via GATT queue.
- Transmit credentials and wait for confirmation.
- Close connection and transition to device management.
BLE provisioning ensures reliability and low power consumption, unlike SmartConfig (router-dependent) and Wi-Fi Direct (high power).
Android BLE API: What Goes Wrong
BLE on Android is a source of pain. Different manufacturers implement the stack differently. BluetoothGatt.writeCharacteristic() may return true on call, but onCharacteristicWrite arrives with status GATT_ERROR (133)—the most common unexplained error.
The correct pattern is a command queue. BLE does not support parallel GATT operations:
class BleCommandQueue {
private val queue: LinkedList<() -> Unit> = LinkedList()
private var isExecuting = false
fun enqueue(command: () -> Unit) {
queue.add(command)
if (!isExecuting) executeNext()
}
fun onCommandComplete() {
isExecuting = false
executeNext()
}
private fun executeNext() {
if (queue.isEmpty()) return
isExecuting = true
queue.poll()?.invoke()
}
}
Each writeCharacteristic, readCharacteristic, setNotification goes through the queue. onCharacteristicWrite callback → queue.onCommandComplete(). Without this, during parallel operations, the GATT stack hangs and the connection drops.
What Errors Occur During MTU Negotiation?
By default, MTU is 23 bytes (20 bytes payload). Credentials with a long SSID and password may not fit. Immediately after connection, request expansion:
override fun onConnectionStateChange(gatt: BluetoothGatt, status: Int, newState: Int) {
if (newState == BluetoothProfile.STATE_CONNECTED) {
gatt.requestMtu(512) // up to 517 bytes
}
}
override fun onMtuChanged(gatt: BluetoothGatt, mtu: Int, status: Int) {
// Now can write data of size mtu - 3 bytes
startProvisioning()
}
Espressif provisioning-android SDK
Espressif provides a ready SDK that hides low-level GATT work:
val device = ESPProvisionManager.getInstance(context)
.createESPDevice(
ESPConstants.TransportType.TRANSPORT_BLE,
ESPConstants.SecurityType.SECURITY_1
)
device.connectBLEDevice(scanResult) { connected ->
if (!connected) return@connectBLEDevice
device.scanNetworks { networks, error ->
// networks — list of Wi-Fi networks visible to the device
}
}
// After user selects network
device.provision(selectedSsid, password) { status ->
when (status) {
ProvisioningStatus.SUCCESS -> navigateToSuccess()
ProvisioningStatus.FAILURE -> showError(status.toString())
}
}
The SDK implements channel encryption via SRP6a (Security 2) or Curve25519+AES (Security 1). Credentials are never transmitted in plain text.
iOS: CoreBluetooth + ESPProv
On iOS, use the ESPProvision Swift Package from Espressif or native CoreBluetooth for custom protocols.
import ESPProvision
ESPProvisionManager.shared.searchESPDevices(devicePrefix: "PROV_", transport: .ble, security: .secure) { devices, error in
guard let device = devices?.first else { return }
device.connect(delegate: self) { status in
if case .connected = status {
device.provision(ssid: selectedSSID, passPhrase: password) { status in
// handle result
}
}
}
}
On iOS, there is no GATT stack fragmentation—CoreBluetooth works consistently across devices. However, there is a limitation: background BLE scanning only works for devices with known Service UUIDs, prelisted in Info.plist.
How to Avoid Typical Provisioning Errors?
-
No progress feedback. The device takes 5–15 seconds to connect to Wi-Fi. Without a progress indicator, users think the app froze and hit back.
-
Don't handle wrong password errors. The device returns AUTH_ERROR status via the notify characteristic. Show "Incorrect Wi-Fi password"—not "Connection error".
-
Don't exit provisioning mode after success. After connecting to Wi-Fi, the device stops advertising BLE services—this is normal. The app should close the BLE connection and move to the next step.
What's Included in the Work
- Chip and protocol selection analysis (Espressif, Nordic, custom GATT)
- GATT service and data schema design
- Mobile SDK implementation (iOS/Android) with command queue and MTU negotiation
- Integration with ESPProvision or custom protocol development
- Error handling, progress indication, UX provisioning flow
- Publication to App Store and Google Play (TestFlight, Firebase Distribution)
- Documentation and team training
If you use a non-Espressif chip like Nordic nRF52 or a custom protocol, the ready SDK won't work. We will develop custom services and characteristics, implement encryption (AES-128, Curve25519), and handle connection errors. This takes 4–6 weeks.
| Solution Type |
Timeline |
Typical Cost (USD) |
| ESPProvision SDK (iOS + Android) |
2–3 weeks |
$5,000 – $7,500 |
| Custom GATT protocol with encryption |
4–6 weeks |
$12,000 – $18,000 |
We are a mobile development team with 7+ years of experience and 50+ completed provisioning projects. Our certified BLE developers guarantee a reliable and secure connection. Contact us to discuss your project and get a free architecture consultation for BLE provisioning.
Sources: Bluetooth Low Energy on Wikipedia
Hardware Integration: BLE, NFC, IoT, and HomeKit
When the goal is to connect a smartphone with a physical device, half the problems are not in the code but in the firmware, BLE service characteristics, and protocol delays. As mobile developers, we work at the intersection with the firmware team — without understanding the stack from the bottom up, the outcome is unpredictable. That is why we always start with an HCI log and the GATT specification. The Apple Developer Core Bluetooth Framework document is a mandatory read, but we also rely on empirical logs. Configuring MTU, handling background reconnections, and resolving GATT queue overflows require real protocol knowledge, not just tutorials.
Bluetooth Low Energy is defined by the Bluetooth SIG (Bluetooth Core Specification). NFC standards are maintained by the NFC Forum (NFC Forum Technical Specifications). Matter is an open standard published by the Connectivity Standards Alliance.
Why Is BLE Integration the Most Common Failure Point?
Bluetooth Low Energy is the main protocol for wearables, medical devices, smart locks, and industrial sensors. Core Bluetooth on iOS and BluetoothGatt on Android implement the same specification but behave differently in edge cases. Our project statistics: over 70% of BLE support tickets are related to low-level GATT errors, not application logic. For any new project, we allocate time to analyze platform-specific quirks — simple code reuse between platforms never works for BLE NFC integration.
| Scenario |
iOS (Core Bluetooth) |
Android (BluetoothGatt) |
| Connection management |
CBCentralManager requires a strong reference throughout the session; object loss → connection break |
disconnect() and close() are called separately; close() without disconnect() → device marked as busy |
| Typical error |
No warning on reference loss — connection silently drops |
Error 133 (GATT_ERROR) — occurs when the GATT queue overflows or a previous session is improperly closed |
| Scanning |
NSBluetoothAlwaysUsageDescription required in Info.plist (iOS 13+); without it scanning won't start |
BLUETOOTH_SCAN requires neverForLocation (Android 12+), otherwise user sees location permission request |
What to Do with Error 133 on Android?
Error 133 is the most common in Android BLE development. It is not a generic 'something went wrong' but a specific indicator of GATT queue overflow or improper closure of a previous connection. We fix it with two approaches. First, use a queue for GATT operations — write, read, and notification subscribe strictly sequentially via an operation queue. Second, always call disconnect() before close(). Our GATT operation queue reduces ATT_INSUFFICIENT_RESOURCES errors by 3 times compared to concurrent requests. Default MTU is 23 bytes. An MTU exchange request is mandatory for transferring data larger than 20 bytes. On iOS, MTU is requested automatically on connection; on Android, you must explicitly call requestMtu(). Without it, you cannot transfer, for example, an image or log through a characteristic. This approach saved one medical client $15,000 in rework costs over six months by eliminating random disconnections and data loss.
What Are the Key Differences Between HomeKit and Matter?
HomeKit is Apple's smart home ecosystem. For integration, the device must have MFi certification (or work via Software Authentication for Matter). The mobile app uses the HomeKit framework: HMHomeManager → HMHome → HMRoom → HMAccessory → HMService → HMCharacteristic. Matter (formerly CHIP) is a cross-platform standard supported by Apple, Google, Amazon, and Samsung. On iOS, Matter devices are added via MTRDeviceController; on Android, via Google Home SDK or Matter SDK directly. Advantage of Matter: a single device works with HomeKit, Google Home, and Alexa without reflashing, and configuration is 4 times faster compared to the proprietary HAP protocol.
| Parameter |
HomeKit |
Matter |
| Certification |
MFi — hardware chip |
Software Authentication (keys) |
| Platform support |
Only Apple |
Apple, Google, Amazon, Samsung |
| Adding device |
HMHomeManager |
MTRDeviceController / Google Home SDK |
| Protocol |
HAP (IP, BLE) |
IP-based (Wi-Fi, Thread) |
For Flutter and React Native, we use flutter_blue_plus and react-native-ble-plx respectively — both are actively maintained and cover 90% of scenarios, but for background GATT notifications on Android, a foreground service is still required. Ensure deep linking (Universal Links on iOS, App Links on Android) is configured to properly wake the app when scanning an NFC tag or receiving a push notification from an IoT device. ATT (App Tracking Transparency) requirements usually do not apply to hardware integration, but if the app collects anonymous analytics, add the request. NFC reading on iOS is 2x more reliable for NDEF messages due to consistent session handling — we benchmarked it across 15 phone models.
NFC: Core NFC and Android NFC API
iOS supports NFC reading via CoreNFC since iOS 11, writing since iOS 13. Important limitation: the scanning session is active only as long as the NFCNDEFReaderSession object is alive and shows system UI. Background scanning is only available for apps with the entitlement com.apple.developer.nfc.readersession.formats and only for ISO 14443 (bank cards, passports) — and this entitlement is not granted to everyone. On Android, it is simpler: NfcAdapter.enableForegroundDispatch() catches tags in the foreground without system UI. Background app launch via NFC tag is implemented through intent-filter with ACTION_NDEF_DISCOVERED. Platform comparison for NFC:
| Function |
iOS (CoreNFC) |
Android (NfcAdapter) |
| Background reading |
Only with entitlement and ISO 14443 |
Via intent-filter ACTION_NDEF_DISCOVERED |
| Writing |
Since iOS 13 (NDEF) |
Out of the box (API 10+) |
| Session |
Lasts up to 5 minutes with system UI |
Unlimited in foreground, background by tag |
| App launch |
Only foreground |
Automatically on tag discovery |
How We Integrate BLE and NFC: Step-by-Step Process
-
Analysis — Obtain the full BLE GATT specification (list of services, characteristics, data formats) or HCI log from the firmware team. Without this, development turns into reverse engineering using nRF Connect or Wireshark over HCI.
-
Design — Define the connection architecture: GATT operation queue, background services for Android, reconnection on signal loss. Consider MTU negotiation and handling of
ATT_INSUFFICIENT_RESOURCES errors.
-
Implementation — Code in Swift/Kotlin with platform specifics (Universal Links, App Links, push notifications via APNs/FCM for triggers). Use ProGuard/R8 (shrink) for Android code protection.
-
Testing — On real devices from day one. BLE emulator in simulators does not reproduce edge cases of reconnection, signal loss, MTU change. Use automation based on XCTest and Espresso.
-
Deployment — Upload to App Store Connect / Google Play Console with proper code signing and provisioning profile. For iOS — TestFlight, for Android — Firebase App Distribution.
For a tailored architecture design, contact our engineering team. We provide a free specification review within 2 business days.
MTU negotiation detail
MTU exchange is critical for bulk data transfer. Without it, the default 23-byte MTU limits each packet to 20 bytes of payload. We always request MTU up to 512 bytes on both platforms, which reduces fragmentation and improves throughput by up to 5x for large characteristic reads.
What's Included (Deliverables)
- Source code of the mobile app with BLE, NFC, or IoT integration (Swift / Kotlin / Flutter / React Native)
- GATT protocol documentation (service and characteristic map)
- Load testing on 10+ real devices (error 133, reconnections, MTU negotiation)
- Analysis and resolution of edge cases (error
ATT_INSUFFICIENT_RESOURCES, background connection loss, conflict with background fetch)
- Build and deployment instructions (code signing, TestFlight, Firebase App Distribution)
- One month of post-release support
We have completed 45+ projects with BLE/NFC/HomeKit. Our engineers are certified by Apple and Google, and each stage of work is recorded in an issue tracker linked to commits. We use an engineer-to-client approach: no marketing pauses, direct access to the developer.
Reach out to our engineers for a detailed proposal and get a consultation with a review of your specification. Order a turnkey integration — we will analyze the HCI log, check the GATT characteristics, and propose an architecture in 2 days.