Bluetooth on Android emulator

Viewed 1123

Basically, when I was initially developing a Bluetooth Android app, I was able with my desktop PC to "enable" the Bluetooth. Instead on my laptop as soon as I executed bluetoothAdapter.getDefaultAdapter() I got a crash. Now I'm retrying for the sake of error reporting and I've got this error with no crash:

E/BluetoothAdapter: Bluetooth binder is null

I ask the user to enable the bt on the app's opening, and if he refuses the app shuts down, instead if he accepts I use the Android's intent for the bt activation and I wait for the user to enable it. If I click yes on the first dialog it keeps showing infinitely when executing in my laptop's emualtor, instead if I press no, the app is closed.

When I was in the PC emulator I was able to get a non-NULL value from getDefaultAdapter() and do some basic testing, instead, when executing on the laptop, I get NULL. I know is NOT possible to make two emulators connect each other via Bluetooth (from How to use android emulator for testing bluetooth application?), but would be handy to use the emulator for other app's features beside Bluetooth without having each time to wire up my phone.

0 Answers
Related