Search code examples
androidbluetooth-lowenergybeaconaltbeacongoogle-nearby

AltBeacon lib as alternative of Nearby Messages API


I am looking for an implementation of AltBeacon library which can send messages as Google Play's Nearby Messages API does. I asked a similar question which was answered but poses limits.

I think from the docs I found out how to read messages. I need some help in finding out how to send messages while advertising. Nearby messages API allows message size up to 100kB. My requirement is in between 50bytes to 2kB.

Please name open-source alternatives to Nearby Messages API, if you know any.


Solution

  • The Nearby API requires both a server infrastructure to get long messages to pop up on Android phones when near a beacon. The way it works is that the Android client reads the short beacon numeric identifier, then calls a server to convert the short numeric identifier to a long message to be displayed to the user, then the Android client shows the message to the user.

    For this reason, it isn't just a matter of getting an open source Android SDK. You also need a server convert the beacon identifiers to long messages. So long as your messages are public and have no special security requirements, you can simply use a web server to host the messages at URLs tied to the beacon identifier. Like this:

    1. Android app detects a beacon with AltBeacon identifers

      2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6 2737 47832

    2. Android app calls your webserver to get the content from

      http://your-domain-name/beacon-messages/2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6_2737_47832

    3. The webserver returns a block of text of up to 2kB (or perhaps JSON if you need multiple fields) published at the URL above.

      "This is my message that can be up to 2kB long"

    You can also use a number of online key/value storesdatabases (Amazon S3, http://www.kvstore.io/, etc.) store information like this, but they typically are not free or open source. There are also a number of SDKs that do all of the above for you, but as the require hosting, I do not know of any that are free and open source.

    Using your own web server allows you to do this without any proprietary software.