Skip to content
This repository has been archived by the owner on May 1, 2021. It is now read-only.

TappyBLE Fundamentals

Luke Van Oort edited this page Mar 11, 2016 · 4 revisions

The TappyBLE is a Bluetooth Smart (aka Bluetooth Low Energy/BLE) connected NFC reader. So, while using it entails some knowledge of NFC, it is important to remember that from the Android perspective, the TappyBLE is just another BLE device, not an NFC device. While this is relatively obvious, it has a significant impact on your application logic and what a logical application structure entails. This section provides an introduction to some of the Android BLE-specific issues as they impact the TappyBLE.

Device Requirements

Android Version

Android introduced BLE support with version 4.3, which corresponds to API level 18 (JELLYBEAN_MR2). This SDK is not compatible with the BLE API Samsung included in some of their 4.2 devices. If you intend to connect to multiple Tappies, version 19+ supports a maximum of 7 simultaneous connections while 18 only supports 4.

Hardware

The device must support Bluetooth Smart/Bluetooth Low Energy. Note that this is not the same as supporting Bluetooth 4.0, some devices that support Bluetooth 4.0 and API 18+ do not support BLE (the Nexus 10 for instance). This requirement should be included in your AndroidManifest.xml as follows

    <uses-feature android:name="android.hardware.bluetooth_le"
                  android:required="true"/>

Permissions

One does not need to hold the NFC permission in order to use the TappyBLE. However, on all devices you will need the BLUETOOTH and BLUETOOTH_ADMIN permissions. Additionally, on API 23+, you will need to hold the ACCESS_COARSE_LOCATION or the ACCESS_FINE_LOCATION runtime permission in order to get scan results when searching for BLE devices. Therefore, you should add the following to your AndroidManifest.xml

    <uses-permission-sdk-23 android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.BLUETOOTH"/>
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

In addition to declaring it in your manifest, you must request the location permission at runtime. For details of how to request runtime permissions, please read the relevant section of the Android Developer Guide.

Enabling BLE

As it is extremely common for users to turn off Bluetooth to improve their device's battery, it is very important to check to make sure Bluetooth is currently turned on. For details on how to do this, please read the 'Setting Up Bluetooth' section of the Bluetooth page on the Android Developer Guide.