How to mimic proximity to a bluetooth beacon through an Emulator

392 views Asked by At

I want to use an emulator to "pretend" to be in the presence of a beacon given a UUID, major and minor.

I understand that emulators themselves don't directly support Bluetooth but is there any way to inject a Bluetooth device into the list of devices the emulator sees?

Does there exist an Xposed Module or some sort of root that can adhere to this behaviour?

1

There are 1 answers

2
davidgyoung On

Standard Android emulators provide no way to simulate Bluetooth detections, so this is not possible at an Android API level.

If you use the open source Android Beacon Library, however, it does provide a BeaconSimulator (See here ) Interface so you can inject beacon detections when using an Android Emulator.

To do this, simply create a new class that implements this interface, construct an instance and then register it like this: BeaconManager.setBeaconSimulator(myBeaconSumulator)

After doing this, your app will detect any beacons in the list returned by your myBeaconSimulator object’s getBeacons() method when your app is running in debug mode on both Android Emulators and physical Android devices.