-1

First an foremost I would like to apologise if this is a trivial question, however it has been costing me a few workdays worth of freetime and I am appearantly too incompetent to figure this out myself.

I am currently tasked with developing an Android BLE-Client that scans and processes specifically Eddystone-based Bluetooth LE beacons. Unfortunately, I am having trouble finding a way of properly testing my software since I don't have any actual BLE Beacons or means of programming them (setting the namespace-portion of the Eddystone UUID, for example). My workplace has not provided me with any beacons and I am also unsure where I would get a beacon with customiseable Eddystone-UID parameters (within the next few days).

Since the android emulators don't have any inbuilt bluetooth emulation features, my initial thought was to use an app called 'Beacon Simulator', found on the google play store. Feature-wise it has everything I need, however I only have one physical device. I would need one android phone to be a BLE-Server and one to run my app / be the BLE-Client.

Since it does not matter if the fake Beacon is debuggable, I thought of using alternative ways of running Beacon Simulator:

I have tried installing Android-x86 on a Virtual-Box-VM, however I could not get my Bluetooth-USB-Dongle to passthrough correctly.

I have tried using the android studio emulator and bluestacks, however neither of them seem to recognise any real bluetooth hardware/seem to have no support for it.

I have looked for options of emulating a beacon on windows (making my laptop the beacon), but most programs I found are shady at best. Maybe someone else knows of a better program here.

Features I need my setup to have:

  • Ability to configure one or more basic Eddystone-Based Beacon, including Namespace and Instance ID. (optional bonus: Ability to configure Eddystone-TLM Frames as well)
  • Having this beacon be discoverable by either an android-studio emulator or my physical device (I only have 1)

I dont really care if there is an actual beacon active, it just needs to be "good enough" to verify my code works as intended. There will be a test-run with actual physical hardware down the line, however I don't want to show up with completely non-functional code.

Given how much trouble I have been having getting this to work, I am honestly suprised that I can't find any answers to this problem online. How would a better developer debug and develop for BLE? Is there anything I am missing?

EDIT - MY SOLUTION: Context: I work part-time and I am under some time constraints to getting hardware is less of a financial issue or an issue with my boss but simply not feasible given the nature of my employment.

I got a customiseable beacon to work by setting up a Ubuntu 21.10 VM-Ware Virtual Machine and passing a bluetooth adapter to it. Then you can use bluez & bluetoothctl to launch a beacon. This beacon is then visible on my physical personal android phone which can be debugged using android studio as normal. Therefore my solution makes hosting a beacon on the same pc running android studio possible, which eliminates the need for extra hardware (aside from a single physical android device to run your app) in my use case.

To get a simple beacon going, first make sure youre up to date. Unfortunately, this seems to not work correctly on old bluez versions.

Then enable experimental mode In /lib/systemd/system/bluetooth.service change the line

ExecStart=/usr/lib/bluetooth/bluetoothd

to include the --experimental flag at the end

ExecStart=/usr/lib/bluetooth/bluetoothd --experimental

(this may not be required on new enough versions of bluez. This depends on what version is included in your linux flavours repositories)

Then restart the VM or reload the bluetooth service.

For a example for getting a basic eddystone URL beacon going see this answer

Note: It may be necessary to disable "share bluetooth devices" in the USB-Settings in VMWare Player and to enable "display all usb devices". Then you need to directly connect the bluetooth adapter to the VM (disconnecting it from the host PC). I recommend using a modern bluetooth dongle for this, as internal bluetooth adapters may not react well to this. Personally, I only got it to work using a dongle.

1
  • 3
    "How do android developers develop BLE-Clients without BLE Hardware?" I don't. I say to my boss "This project isn't feasible unless you can get me the hardware". Commented Feb 12, 2022 at 18:47

2 Answers 2

2

This unfortunately isn't a "software development" question, it's a financial one.

Simply put, you need to tell your employer to get you another phone. In fact, they should get you at least 3 more, plus whatever real hardware you are going to use. Don't get it down the road, get it right now.

For any reasonable dev salary, the time you are going to waste screwing around trying to get something to work instead of just getting another phone, is going to translate into a dollar value wasted comparable to a dozen phones. A few workdays worth of work is easily several flagship phones in cost.

I've done a lot of Bluetooth <-> Android dev work over the years, and right this instant I have 8 phones sitting on my desk, and in a box in the window sill above me is probably another two dozen. If you are going to be doing a lot of BLE work, you should expect to have a similar situation before too long.

edit: and don't let them cheap out and get you some 5 year old used budget phone either. A lot of beacon stuff uses BLE5 and extended advertising which few older model non-flagship phones had support for.

0

Nordic has inexpensive development boards for their BLE chips along with sample projects. Including a beacon project which has an easy to change UUID #define. Also possible is partial progress by scanning for all BLE beacons. Its likely there will be some beacons around. A useful utility is Nordic's nRF Connect for Android.

Not the answer you're looking for? Browse other questions tagged or ask your own question.