BLE GATT Data Exchange: Notifications, MTU, and Queue Operations

Organizing GATT Data Exchange with BLE Peripherals Imagine you're developing an app to interact with a medical heart rate sensor via BLE. After connecting, you try to subscribe to heart rate notifications, but data doesn't arrive. On Android, you see status 133 error; on iOS, writing the characte

Development and support of all types of mobile applications:

Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1All 1734 services
BLE GATT Data Exchange: Notifications, MTU, and Queue Operations
Complex
~3-5 days

Our competencies:

Frequently Asked Questions

Latest works

  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    894
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    782
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1216
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    1079
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    1002
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    597

Organizing GATT Data Exchange with BLE Peripherals

Imagine you're developing an app to interact with a medical heart rate sensor via BLE. After connecting, you try to subscribe to heart rate notifications, but data doesn't arrive. On Android, you see status 133 error; on iOS, writing the characteristic returns an error. We've encountered this in over 20 BLE integration projects: medical sensors, fitness trackers, industrial controllers. One common task is subscribing to heart rate notifications or transferring large data volumes, like a 100 KB firmware. With the default MTU of 23 bytes, sending 100 KB takes about 5000 packets, which takes minutes. Requesting a larger MTU of 512 bytes reduces packets to ~200 and transfer time to seconds. We've developed a systematic approach to reliable BLE data exchange: from proper notification subscription to operation queues and MTU negotiation.

GATT Characteristic Operation Types

Each GATT characteristic has a set of properties flags that determine possible operations. Here's a quick reference table:

Flag iOS (CBCharacteristicProperties) Android Operation
Read .read PROPERTY_READ One-time read
Write .write PROPERTY_WRITE Write with acknowledgment
Write Without Response .writeWithoutResponse PROPERTY_WRITE_NO_RESPONSE Fast write
Notify .notify PROPERTY_NOTIFY Notifications without acknowledgment
Indicate .indicate PROPERTY_INDICATE Notifications with acknowledgment

Write Without Response is faster — no ACK from the device. Suitable for streaming (audio, sensor readings). Write is for commands where delivery guarantee is important.

MTU: How to Increase BLE Channel Throughput

By default, BLE MTU (Maximum Transmission Unit) is 23 bytes, with only 20 bytes of payload. To transfer 10 KB of data, that means 500 packets. If you request a larger MTU (e.g., 512), the number of packets drops to ~20 — saving up to 90% time. Here's how to do it on each platform:

Platform Default MTU Automatic Negotiation Manual Request
iOS 23 Yes (since iOS 9+) Indirectly via maximum write length
Android 23 No gatt.requestMtu(512) + callback onMtuChanged

In practice, most BLE chips support MTU 247–512 bytes. This is critical for firmware or large configuration transfers.

How to Subscribe to BLE Notifications and Not Miss Data?

Notification subscription is the standard way to receive real-time data from a BLE device. On iOS, just call setNotifyValue(true, for:). But on Android, the process is more complex: you need not only to enable notifications locally, but also explicitly write the value ENABLE_NOTIFICATION_VALUE to the CCCD (Client Characteristic Configuration Descriptor) descriptor. Many developers skip this step — and notifications don't arrive.

iOS: Notify Subscription and Parsing

// Enable notify peripheral.setNotifyValue(true, for: characteristic) // Receive data func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) { guard error == nil, let data = characteristic.value else { return } // Example: sensor sends 3 bytes [flags, heartRate, energyExpended] guard data.count >= 2 else { return } let flags = data[0] let heartRate: Int if flags & 0x01 == 0 { // heart rate in 1 byte heartRate = Int(data[1]) } else { // heart rate in 2 bytes (little-endian) heartRate = Int(data[1]) | (Int(data[2]) << 8) } } 

Working with binary data via Data + byte offsets. If the device is non-standard and documentation is scarce, Wireshark + BLE sniffer help decode the protocol.

Android: Notify + CCCD Descriptor

Notifying requires two steps: enable notify locally and write the CCCD on the device:

fun enableNotification(gatt: BluetoothGatt, characteristic: BluetoothGattCharacteristic) { // Step 1: enable locally gatt.setCharacteristicNotification(characteristic, true) // Step 2: write descriptor to device val cccd = characteristic.getDescriptor( UUID.fromString("00002902-0000-1000-8000-00805f9b34fb") ) ?: return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { gatt.writeDescriptor(cccd, BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE) } else { @Suppress("DEPRECATION") cccd.value = BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE @Suppress("DEPRECATION") gatt.writeDescriptor(cccd) } } 

Step 2 is often missed — and notifications don't arrive. This is the most common mistake when working with notify.

Why Does Android Show status 133 Error and How to Avoid It?

One critical detail of Android BLE: you cannot perform multiple GATT operations simultaneously. Only one operation in flight. Send the next only after receiving the callback for the previous one. Violating this rule leads to status 133 error or data loss on most Android devices.

Solution — a queue:

class BleOperationQueue { private val queue: LinkedList<BleOperation> = LinkedList() private var operationInProgress = false fun enqueue(operation: BleOperation) { queue.add(operation) if (!operationInProgress) { executeNext() } } fun onOperationCompleted() { operationInProgress = false executeNext() } private fun executeNext() { val op = queue.poll() ?: return operationInProgress = true op.execute() } } 

BLE Exchange Implementation Process

We break down implementing reliable BLE exchange into stages:

  1. Analysis of the device protocol or GATT service specification.
  2. Design of the operation queue and data parsing scheme.
  3. Implementation on target platforms (iOS/Android) with MTU, connection, reconnection handling.
  4. Testing on real devices with various OS versions.
  5. Integration into the client's application and documentation delivery.

What's Included in the Work

As part of the service, we provide:

  • Analysis and documentation of the current BLE device protocol.
  • Source code for the data exchange module in Swift/Kotlin with operation queue and MTU support.
  • Integration testing on 3+ real devices.
  • Brief API documentation for the module.
  • One month of consultation after delivery.

We guarantee stable notification subscription, correct command writing, and error handling on both platforms. Contact us for a preliminary assessment of your project. Get a consultation from our engineers if you're looking for a ready-made BLE integration solution or encountering data exchange errors.

Timeline and Pricing

Implementation timeline — from 3 to 10 days depending on binary protocol complexity and number of platforms. Pricing is calculated individually after requirement analysis.