Bluetooth Low Energy in Android Java 1st Edition Tony Gaitatzis BackupBrain Publishing, 2017 ISBN: 978-1-7751280-1-4 backupbrain.co Bluetooth Low Energy in Android Java by Tony Gaitatzis Copyright © 2015 All Rights Reserved All rights reserved This book or any portion thereof may not be reproduced or used in any manner whatsoever without the express written permission of the publisher except for the use of brief quotations in a book review For permission requests, write to the publisher, addressed “Bluetooth Android Book Reprint Request,” at the address below backupbrain@gmail.com This book contains code samples available under the MIT License, printed below: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE (this page intentionally left blank) Dedication To Sierra, for lending me a phone and Bruno for being much more thorough than I could ever be (this page intentionally left blank) Preface Thank you for buying this book I’m excited to have written it and more excited that you are reading it I started with Bluetooth Low Energy in 2011 while making portable brain imaging technology Later, while working on a friend’s wearable electronics startup, I ended up working behind teh scenes on the TV show America’s Greatest Makers in the Spring of 2016 Coming from a web programming background, I found the mechanics and nomenclature of BLE confusing and cryptic A er immersing myself in it for a period of time I acclimated to the di erences and began to appreciate the power behind this low-power technology Unlike other wireless technologies, BLE can be powered from a coin cell battery for months at a time perfect for a wearable or Internet of Things (IoT) project! Because of its low power and short data transmissions, it is great for transmitting bite size information, but not great for streaming data such as sound or video Good luck and enjoy! Section Conventions Used in this Book Every developer has their own coding conventions I personally believe that well-written code is selfexplanatory Moreover, consistent and organized coding conventions let developers step into each other’s code much more easily, enabling them to reliably predict how the author has likely organized and implemented a feature, thereby making it easier to learn, collaborate, fix bugs and perform upgrades The coding conventions I used in this book is as follows: Inline comments are as follows: // inline comments Multiline comments follow the JavaDoc standard: /** * This is a multiline comment .. .Bluetooth Low Energy in Android Java 1st Edition Tony Gaitatzis BackupBrain Publishing, 2017 ISBN: 978-1-7751280-1-4 backupbrain.co Bluetooth Low Energy in Android Java by Tony Gaitatzis... OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE (this page intentionally... between the Android and the Arduino using Bluetooth Low Energy (BLE) Although the examples in this book are relatively simple, the app potential of this technology is amazing To program the Android,