Friday, January 26, 2018

A Sample Android App for My Beacon Management System

I was very busy lately with my own project(I am currently developing a Beacon Management System). Part of this system is to detect the current configuration settings of the beacon and to do this, the app must be able to detect the beacon, connect to it and read the services and characteristics of that beacon and store the received value on a MySql database.

I am using MIT App Inventor 2 to develop the app and today, I just succeeded in creating the app(the BLE part) and here is the portion of the app I just created(I created a small app as a demo).

The initial screen looks like below:



When the "Scan" button is clicked/tapped, the app begins to scan for available devices and display all found devices on a list view:
Initially, the background color of the listview is light yellow-orange, when the listed device was clicked/tapped, the background color becomes dark gray and the "click" even is triggered. The "click" event will connect to the selected device and when successful, the labels below the buttons get updated. And the clock object not visible on the screen gets activated and after 5 seconds its "timer" event is triggered and will read the instance id of the connected device. I was able to determine the instance id of the beacon from nrfConnect app screen below, highlighted in red rectangle, the value is in hex 0x00-00-00-00-00-25 this is equal to 37 in decimal.


And here is the screenshot after the clock "timer" was executed:


The rssi of the device gets updated each time its rssi changes and the label gets updated too. When using this app, the device must be in connectable mode so that its services and characteristics can be accessed and red.

The other two buttons are obviously labeled to correspond to its corresponding functions which is to disbable the phone from scanning other devices and disconnect to the beacon when connected.

You can download the app here. Remember that this app is tested for Minew Beacons only.