O'Reilly logo

IoT Projects with Bluetooth Low Energy by Madhur Bhargava

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Application code

So far so good. At the end of previous step, we hope that you have included the earlier mentioned files in your code preferably in a separate package. Now, we start writing our App:

  1. We shall create a simple UI, which is nothing much but just a text view on a screen to display our Beacon data. For this, navigate to the activity_main.xml file in the design view and drag and drop a textView. Apply constraints and position the text view to the top of the screen:
Figure 14: Adding the TextView
  1. Our very basic UI is ready. Now, we need to scan and discover the Beacon first. For this, create a class by the name of BleUrlDeviceDiscoverer ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required