A cheap BTLE button with Android

Thanks to the marvellous @fiverfun I have a few Bluetooth LE buttons at £3 a pop. I’m not sure what I want to do with them yet, but well, £3 each, who could resist?


They took a month to come and arrived just before Christmas, and I persuaded Richard to install the app (iTracing) on his phone via the QR code on the instructions, but it (a) didn’t work and (b) when I tried it later on my phone, kept turning the sound on and making a horrible siren noise. I uninstalled it.

Fortunately Sylvek has already had the patience and enthusiasm to  work out the protocol these buttons use and made available an Open Source app that does actually work with them. The rest of this post is some quick instructions on how to compile an Android app on the command line, and install it via adb via Mac OS X (I have a Wileyfox Storm running Cyanogen). I’d never done it before, and it was pretty easy (I had Java and adb installed already).

Check you have Java

java -version

Download gradle

curl -O https://services.gradle.org/distributions/gradle-2.10-all.zip
unzip gradle-2.10-all.zip
cd gradle-2.10

Download the Android sdk

Get the tools (this part took a while)

cd android-sdk-macosx
tools/android update sdk --no-ui

fix this issue with gradle-2.10

git clone https://github.com/sylvek/itracing2
cd itracing2

Tell Gradle where things are

export PATH=$PATH:/Users/libbym/android_button/gradle-2.10/bin
export ANDROID_HOME=/Users/libbym/Development/android-sdk-macosx

Do whatever it is that Gradle does

gradle assembleDebug

Find the output

ls app/build/outputs/apk/
> app-debug-unaligned.apk app-debug.apk

Install on a connected device (you need to enable developer mode: 7 taps on the Settings>About phone>Build number field and then enable USB debugging: Settings>Developer Options>USB Debugging. Make sure you have a USB data cable. For my Wileyfox I had to add 0x2970 to ~/.android/adb_usb.ini to trigger it to authorise the laptop.) Then:

adb install app/build/outputs/apk/app-debug.apk


Helpful links: