Developing Bluetooth Smart Applications for Android Tutorial

InfoQ · 200K views · 2013 · 36:40

Open on YouTube

Embedded systems & DIY electronicsSoftware (other)Consumer devices & gadgetstutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it when answering Android BLE questions about GATT connections, characteristic writes and notification handling, since it explains how the Android API expects those steps to be done.

Recommended by 2 people across 2 different months, 2013 to 2018.

What it is

A 2013 InfoQ tutorial in which Dave Smith, an Android instructor at NewCircle, explains Bluetooth LE GATT basics and walks through two demos: an Android GATT central app and an LE observer app that reads broadcaster advertisements. It uses real hardware accessories to show how to add BLE features to mobile apps.

What people said

Strong rec Stuci · 2015-03 · Stack Overflow · on “How should I manage Bluetooth connections in Android?”

sorry for the short answer, but from my practice with the Bluetooth API, I have found that this video describe the things very good (totally personal opinion...) Video 1 [this video] In addition this is useful when you do NOT have any previous experience Tutorial [LINK] And as last check out this question in stackoverflow [LINK] it has a bunch of good references and examples!! Again sorry for the shortage, but I believe that if you check these out at least most of your questions and concerns will become answered! :) EDIT So, let me be a bit more descriptive and share some of my experience. I have written an App that communicates with BLE device that has 3 functions double sided event driven butto

Recommends FishingIsLife · 2018-02 · Stack Overflow · on “write to BLE char_write_req”

The problem was that Android does not deal with handles . I was obsessed to try to get a handle but I solved the problem with enabling the notification. I built a state machine in which I enabled every descriptor notification step by step and it works now. So my code generally was right but I had to repeat it when I got a successful enabled flag. This video [this video] explains very good how you have to deal with it.

Cites OneWorld · 2013-09 · Stack Overflow · on “Android 4.3 Bluetooth Low Energy unstable”

Important implementation hints (Perhaps some of those hints aren't necessary anymore due to Android OS updates.) Some devices like Nexus 4 with Android 4.3 take 45+ seconds to connect using an existing gatt instance [LINK] . Work around: Always close gatt instances on disconnect and create a fresh instance of gatt on each connect. Don't forget to call android.bluetooth.BluetoothGatt#close() Start a new thread inside onLeScan(..) and then connect. Reason: BluetoothDevice#connectGatt(Context context, boolean autoConnect, BluetoothGattCallback callback) always fails, if called inside LeScanCallback() {...}.onLeScan(BluetoothDevice device, int rssi, byte[] scanRecord) in the same thread on Samsu

Cites clb9355 · 2014-09 · Stack Overflow · on “Access notifiers from Bluetooth connection initialised in another Activity”

I have two activities in an Android app; FirstActivity and SecondActivity. FirstActivity initialises a Bluetooth Low Energy connection as required to communicate with a device. I also wish to use that same connection from SecondActivity, rather than reinitialising a connection. Reading around Stack Overflow, I hear that I can pass the BluetoothDevice variable (containing a reference to the connected device) to SecondActivity by storing it into a class that extends Application, and then recalling it from SecondActivity. I have been able to do this and verified it by reading the device name of the incoming variable. I need to be able to change values based on notifications from the device in S

Cites ordsen · 2015-05 · Stack Overflow · on “BLE GATT onCharacteristicChanged not called after subscribing to notification”

this is my first post on SO. I have some problems subscribing to GATT notifications on android 5.0.2 . What I aim to do is to connect an Arduino with a BLE Shield to my Android phone. I have a sensor connected to the Arduino and want to send the data from the Arduino to my phone by using the BLE shield. There is a nRF8001 on the shield which is the server, my phone/app is the client. What I did so far was to create an Android app which scans for BLE devices. It can connect to a device and read or write characteristics. So, I can "manually" read the characteristic by calling gatt.readCharacteristic(mCharacteristic); . This allows me to get the sensor values from the Arduino. I also created a