Tuesday, November 15, 2016

Beacon and Egg For Breakfast

It's been a while since I wrote something (uhm like anyone cares bro :D)

Someone recently introduce me to Beacons which really got my attention. I think I haven't heard it here in the Philippines that's why I'm trying to learn about this technology and how it works (and possibly implement it in the future).

So what actually is a (Bluetooth) Beacon?
Bluetooth beacons are hardware transmitters - a class of Bluetooth low energy (LE) devices that broadcast their identifier to nearby portable electronic devices. The technology enables smartphones, tablets and other devices to perform actions when in close proximity to a beacon. - Wikipedia
As far as my understanding goes.. Basically it uses BLE or Blueooth low energy technology to advertise signal which can be received or detected by other devices like smartphones. Although mostly you can see it as a hardware transmitter it can also be emulated or spoofed using a smartphones or other devices like arduino. Since I'm more on software development (duh you're a programmer bro) I'm more interested on developing Beacon emulation on a smartphone. I tested a few libraries to try some features and functionalities and found out that there's a few known formats available and possibly just them.

1. iBeacon (Apple) - Apple defined iBeacon prefix, followed by a variable UUID, and a major, minor pair.
2. Eddystone-UID (Google) - A unique, static ID with a 10-byte Namespace component and a 6-byte Instance component.
3. Eddystone-URL (Google) - A compressed URL that, once parsed and decompressed, is directly usable by the client.
4. Eddystone-TLM (Google) - Beacon status data that is useful for beacon fleet maintenance, and powers Google Proximity Beacon API's diagnostics endpoint. -TLM should be interleaved with an identifying frame such as Eddystone-UID or Eddystone-EID (for which the encrypted eTLM version preserves security).
5. Eddystone-EID (Google) - A time-varying beacon frame that can be resolved to a stable identifier by a linked resolver, such as Proximity Beacon API.
6. AltBeacon (Radius Networks) - is made up of a 1-byte length field, 1-byte type field and two-byte company identifier, as prescribed by the Manufacturer Specific Advertising Data structure format, followed by 24 additional bytes containing the beacon advertisement data.

Most of them are almost the same in a way that they all broadcast a unique id iBeacon, Eddystone-UID and AltBeacon. I haven't tried all of them but I personally like Eddystone-URL which advertises a Web URL. I think there's a lot of application for this one since it pushes a URL and you can do plenty of things with it. iBeacon is trademark of Apple and Eddystone is a trademark of Google. AltBeacon on the other hand is an initiative by Radius Network for an open and interoperable specification for proximity beacons.

I have tried building a sample app using Cordova and this library by petermetz from github since Cordova was my first choice. Unfortunately I'm an android user and currently it doesn't support advertisement (yet) although the developer mentioned that it will be included in the future. I chose Cordova because I can't code in Java that means I have a higher chance on making an app using it lol. Anyway, I found a much more complete library using AltBeacon library which is open source by the way. It's probably complete it can parse and emulate any format mentioned above which is nice since you can switch anytime depends on your preference. Currently I'm testing their sample for Xamarin. Xamarin uses C# as language for their mobile development platform and it is the closest language I can understand lol.

Also, while browsing for resources I also came across with the word "The Physical Web" which sparks my curiosity, again :D Currently I'm planning on playing with Eddystone URL format and The Physical Web which works well together and probably make a useful app with it.

My first app in PlayStore I hope! ;)

 

Copyright 2017 Code Monkey