Android Session 3: Bluetooth Low Energy Communication


Inspect a BLE profile using a dedicated application

  1. Explore the Nordic Thingy:52 BLE Profile
    1. Install the nRF Connect Android app
    2. Connect to your Thingy board and explore its profile
    3. Interact with your Thingy board and observe how the Characteristic values are changing

Create an application that reacts on Nordic Thingy button press events

  1. Setup Thingy library
    1. Download the app skeleton from GitHub repository
    2. Clone the Nordic Thingy Library (hint: the Thingy library is located inside thingylib directory)
    3. Follow the instruction from here in order to include the library to your project
  2. Navigate to the ThingyDeviceActivity using an explicit Intent. Follow the TODO 1x comments in code.
  3. Get the Bluetooth device from the Intent. Follow the TODO 2x comments in code.
  4. In order to start using the ThingyLibrary make sure to create an instance of it by adding this line ThingySdkManager.getInstance() inside your activities' onCreate(). TODO 3
  5. Bind/Unbind the MyThingyService. Follow the TODO 4x comments in code.
  6. Create your custom thingy events listener by implementing the ThingyListener interface.
    1. Enable button state notifications inside onServiceDiscoveryCompleted() callback
    2. Display a Toast message when you receive a ButtonStateChangedEvent (hint: onButtonStateChangedEvent() callback)
  7. Register/Unregister your custom ThingyListener by using ThingyListenerHelper.registerThingyListener() and ThingyListenerHelper.unregisterThingyListener helper methods. Follow the TODO 6x comments in code.
  8. Connect to the Thingy board using the ThingySdkManager object. Follow the TODO 7x comments in code.


fss/sessions/session3-android.txt ยท Last modified: 2019/07/04 18:58 by vlad_mihai.corneci
CC Attribution-Share Alike 3.0 Unported Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0