Site icon Embarcadero RAD Studio, Delphi, & C++Builder Blogs

Building Proximity Aware Application with RAD Studio XE8

RAD Studio XE8 provides you with the tools to rapidly design, build, and deploy connected apps that deliver innovative IoT solutions.

The new Beacon component makes it easy to add proximity awareness to your applications.

Two beacon formats are available: iBeacon and AltBeacon.

Bluetooth Low Energy devices in advertising mode send the Advertising Data repeatedly over radio in different AD type structures. 

One of the AD types in the Advertising Data is the “Manufacturer Specific Data” which is utilized for beacons. The data included in the “Manufacturer Specific Data” is:

iBeacon requires both major and minor numbers to be defined. 

Major numbers are designed to identify a group while minor numbers are designed to identify an individual beacon.

TBeacon has a property called MonitorizedRegions that lets you define the UUID, minor and major numbers for your beacons. Generally speaking, all your beacons should use the same UUID. You would then change the Major and Minor values based on your needs. 

If you set the Major and Minor values to -1, it indicates that you want to track all beacons using that same UUID. You can then programmatically define the Major and Minor numbers and execute actions depending on which beacon was detected.

A good practice would be to store the beacon information in a database. Then, the client app running on the user’s smartphone or tablet can connect to the same database.

Upon detecting the beacon in your application, you will receive an event. In the event, you can read the major and minor values and then fire another action, such as displaying a location specific message as the user approaches a specific beacon.

Below is a sample use case showing how major and minor numbers for beacons can be used in a real world scenario to identify them. 

Tradeshow Beacon Use Case:

   4 exhibit halls, so major numbers of 1 – 4 are being used to identify the 4 exhibit halls

–  Each exhibit has 20 booths, so each beacon is assigned a minor number of 1 to 20

–   This means that there are a total of 80 beacons used in this scenario 

 

 

  
Beacons are supported on Android, iOS and OS X. Beacons are not supported on Windows since
the beacon advertising data is not accessible on Windows.
 
Detailed information on setting permissions to use beacons etc. can be found on our docwiki:

Here is a quick code example that finds nearby beacons:

[crayon-672a261d7eecc262110535/]

You can download the demo here. This is the same demo that I showed during the XE8 launch webinar today. It has UUIDs predefined for the following manufacturers:

If you are using beacons by a different manufacturer or are using custom UUIDs, you can add/edit them via the MonitorizedRegions property on TBeacon. 

You can also watch the beacon proximity skill sprint here: https://www.youtube.com/watch?v=_VWFk3RTW8A 

Several different beacon focused demo projects for Delphi and C++ are also installed with RAD Studio XE8. You can access them by going to:

C:UsersPublicDocumentsEmbarcaderoStudio16.0SamplesObject PascalMobile SamplesDevice Sensors and ServicesBluetoothBeacons

C:UsersPublicDocumentsEmbarcaderoStudio16.0SamplesCPPMobile SamplesDevice Sensors and ServicesBluetoothBeacons

 

Download a Free RAD Studio XE8 Trial today: http://www.embarcadero.com/downloads 

 

 

Exit mobile version