Bluetooth Low Energy On Android: Top Tips For The Tricky Bits @ GDG Detroit

  Переглядів 31,074

Stuart Kent

Stuart Kent

День тому

Bluetooth Low Energy (BLE) powers the Internet of Things (IoT): smart watches, smart bulbs, and smart cars all use it for short-range communication. Now that 90% of Android consumer devices and 100% of Android Things devices run software that supports BLE, there’s never been a better time for Android developers to jump into the rapidly-growing IoT ecosystem and start building their own companion apps or custom smart devices.
Unfortunately, Android’s Bluetooth stack has a well-deserved reputation for being difficult to work with. The documentation is patchy, the API abstractions are leaky, and the stack itself is unreliable. I worked through all these challenges while building a pro audio app at the start of 2017, and now I'm sharing my story to save you time.
The beginning of this talk will cover BLE basics. The remainder will showcase code samples and strategies for tackling the quirks of the Android Bluetooth stack. No prior experience with BLE is required to enjoy this talk. You’ll leave excited to tinker with BLE on Android and equipped with a roadmap and toolkit to help you navigate the nasty parts.
Favorite Resources: gist.github.com/stkent/a7f0d6...
Slides: speakerdeck.com/stkent/blueto...

КОМЕНТАРІ: 48
@HQHAN
@HQHAN 6 років тому
Thanks for sharing this lesson and learned. You've done a great job !
@TheViking2
@TheViking2 4 роки тому
Finally, that one worthy video for BLE . Thanks!
@davebound268
@davebound268 5 років тому
Wonderful information Stuart - thank you so much for this. Now I might not go mad.
@maksym1266
@maksym1266 2 роки тому
This is the greatest video about the BLE technology that I've ever seen. Thanks a lot.
@fahim.m.choudhury
@fahim.m.choudhury 3 роки тому
This is one of the best presentations I have ever seen on any technical topic, it's concise, informative and perfectly explained. Thank you very much!
@stuartkent5182
@stuartkent5182 3 роки тому
Thank you for the very kind words :)
@jonathanmartins7744
@jonathanmartins7744 Рік тому
Thank you very much! This talk worth gold!
@80amnesia
@80amnesia 4 роки тому
Finally found a good explanation for Bluetooth LE for android. Thanks!
@stuartkent5182
@stuartkent5182 4 роки тому
Glad you found it useful; thanks for letting me know!
@ehsanpartovi8279
@ehsanpartovi8279 2 роки тому
Amazing video. Informative and succinct. I am new to Android and I thought I was the only one being confused about where to start. Not to mention my Java is tacky, so I wouldn't blame myself. I would appreciate any leads on a descriptive video on multi connections since that's what I am interested in rn. I could not find one on your channel, so I took the chance to ask.
@ashutoshsoni6473
@ashutoshsoni6473 3 роки тому
Thanks a lot, your video on ble is amazing.
@stuartkent5182
@stuartkent5182 3 роки тому
Thank you for the kind words; I'm glad you found it helpful!
@ctkqiang
@ctkqiang 4 роки тому
Finally !!!!!!! A saviour is here!!!!! finally someone taught this in ENGLISH !!!! I am subscribing to this channel!
@izaiahflynn2724
@izaiahflynn2724 2 роки тому
a tip: watch movies at flixzone. I've been using them for watching loads of movies lately.
@deaconeric268
@deaconeric268 2 роки тому
@Izaiah Flynn Definitely, have been watching on flixzone for years myself :)
@michelletseng4610
@michelletseng4610 2 роки тому
Thank you so much!
@qkloh6804
@qkloh6804 3 роки тому
Right on spot, clear and short.
@stuartkent5182
@stuartkent5182 3 роки тому
Glad you liked it!
@naveen1251
@naveen1251 5 років тому
Very informative...
@EmilenL
@EmilenL 6 років тому
Nice video! Just a correction: you don't need to serialize among all peripherals. It is enough with one queue per BluetoothGatt object, since the Bluetooth stack internally can hold one queued operation per BluetoothGatt object. Also, the only benefit of not calling close directly after disconnect is to avoid getting a warning in the log about an internal NullPointerException. So I would say the workaround isn't really needed unless you want the log clean.
@majey666
@majey666 5 років тому
Tho the author regarding the queueing: also, please mind that device is using one antena for connecting to all devices, how it can transfer radio data simultaniously, so the api follow more less the phisical pattern bere. I think that might be cleare and less confusing why it is not so intuitive at first. Anyway, thank you for the video, lots of info I needed.
@gigajoules6636
@gigajoules6636 3 роки тому
Wish I had watched this video BEFORE I wrote the app I'm working on right now but at least I feel confident that I've handled things properly :)
@stuartkent5182
@stuartkent5182 3 роки тому
Props for getting it all figured out! Glad the talk helped you confirm your approach :)
@Existentialkev
@Existentialkev 5 років тому
You're doing God's work good sir
@stuartkent5182
@stuartkent5182 5 років тому
🙏Thanks, glad to help!
@grape99902
@grape99902 4 роки тому
HERO!!!!!! YOU ARE A FUC**** HERO
@jashgopani32
@jashgopani32 3 роки тому
while scanning / connecting or doing any other operations, do we need to do it in a background service or calling the callbacks in the activity is ok? I am working with BLE for the first time on android so I am confused about it. Please help me, Sir :)
@stuartkent5182
@stuartkent5182 3 роки тому
You can safely call methods from the main thread in your Activity or Fragment. However, note that when your callback methods are invoked by the framework, they will NOT be invoked on the main thread (so you'll need to explicitly return to the main thread before updating your UI).
@jashgopani32
@jashgopani32 3 роки тому
@@stuartkent5182 Thankyou sir✌️
@axa.axa.
@axa.axa. 4 роки тому
i put a hole in my screen pounding the thumbs up. Edit add back my initial question: So is location required only for scanning?
@r7stuart
@r7stuart 4 роки тому
That's correct! One update since this talk was given: if you target API level 28 or newer, you _must_ request ACCESS_FINE_LOCATION; ACCESS_COARSE_LOCATION doesn't cut it any more.
@axa.axa.
@axa.axa. 4 роки тому
@@r7stuart good to know
@dirrelito
@dirrelito 3 роки тому
@@axa.axa. Also, for API 28 and above, you may use companion device pairing instead, and you won't need any location permission at all.
@BhAvAnAPaTiL
@BhAvAnAPaTiL 3 роки тому
hey.. I am not able to get devices... location and BLE is on though
@David-gu8hv
@David-gu8hv 2 роки тому
Did you check the permission? You have to even if you put it in the manifest: if((ContextCompat.checkSelfPermission(application, Manifest.permission.ACCESS_FINE_LOCATION)) ==PackageManager.PERMISSION_GRANTED) { val settings = ScanSettings .Builder() .setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY) .setCallbackType(ScanSettings.CALLBACK_TYPE_ALL_MATCHES) .build() bluetoothScanner.startScan(null, settings, scanCallback) }
@rudreshsp3236
@rudreshsp3236 4 роки тому
where is the source code
@rudreshsp3236
@rudreshsp3236 4 роки тому
could you please share link for source code download
@stuartkent5182
@stuartkent5182 4 роки тому
Unfortunately there is no source code available with this talk (it was based on a proprietary project). I recommend checking out github.com/NordicSemiconductor/Android-nRF-Blinky and the underlying library github.com/NordicSemiconductor/Android-BLE-Library/ to see how to use these concepts in practice.
BLE with ESP32 tutorial part 1: the Server
25:23
MoThunderz
Переглядів 66 тис.
Вам какой?
00:29
Янчик
Переглядів 6 млн
Эксперимент во Вьетнаме. Истоки зависимости
00:47
Как делали трек Меломан
00:44
Gazan
Переглядів 1,4 млн
Using Web BLE to detect and get GATT information
19:41
Sayanee Basu
Переглядів 26 тис.
Reverse Engineering Bluetooth Low Energy (BLE) Devices
59:52
Elektor TV
Переглядів 2,8 тис.
Master BLE Basics in Just 10 Minutes: The Ultimate Guide!
9:15
Novel Bits
Переглядів 84 тис.
Kotlin's better than Java? Or vice versa? Let's find out...
5:56
Jelvix | TECH IN 5 MINUTES
Переглядів 55 тис.
Boston Dynamics NEW Humanoid Robot SHOCKS The ENTIRE Industry! (Atlas 2.0)
10:56
Building Android Apps to Control Bluetooth LE Devices
38:51
CrossComm, Inc.
Переглядів 34 тис.
БИТВА ЗУМЕРОВ. iPhone 15 Pro / Samsung S23 Ultra / Realme 12 Pro Plus
13:58
iphone X Convert To Iphone 11Pro #iphonex #iphone11pro #shorts
0:13
Technical Mobile
Переглядів 4,1 млн
Зачем нужна эта кнопка?
0:25
Construct PC
Переглядів 68 тис.
iphone X Convert To Iphone 11Pro #iphonex #iphone11pro #shorts
0:13
Technical Mobile
Переглядів 4,1 млн