I studied about Bluetooth Low Energy.
But I don't have supported BLE device for testing.
Therefore, I want to ask :
Do the Android emulator supports BLE feature for testing?
I tried with the following code on Android Emulator 4.3 (x86) and Android Emulator 4.4 (ARM):
// Use this check to determine whether BLE is supported on the device. Then
// you can selectively disable BLE-related features.
if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
Toast.makeText(this, R.string.ble_not_supported, Toast.LENGTH_SHORT).show();
finish();
}
And it always show "ble_not_supported".
Another question is
Which another emulator or tool supports BLE for Android?
I really want to test BLE feature on Emulator.
It seems you can, using Android inside a VirtualBox and using a PC dongle supporting Bluetooth LE (costs about 18$ on Amazon). Here's the tutorial by Chris Larson (copied here to keep it online):
Android emulators are great for developing BluetoothLE applications. The trick is getting the Android emulator to recognize the BluetoothLE adapter.
What you'll need:
- Androidx86 iso from android-x86.org I used the 4.4 release candidate
- Virtual Machine software: I used Oracle VirtualBox
- A BluetoothLE USB adapter: I used the Cirago Bluetooth 4.0 USB Mini Adapter (BTA8000)(affilate link) or Cirago Bluetooth 4.0 USB Mini Adapter (BTA8000) (non-affilate link)
- Install Android SDK for debugging
- Install VirtualBox
- Download Androidx86
- Open VirtualBox and create a new machine. Set type to linux/other(32bit)
- Set the virtual machine's memory and harddrive space to whatever you need (but at least the minimum specs for Android).
- When asked for the OS image, select the Androidx86 image you download from Androidx86.org
- When the virtual machine boots, choose to install Android.
- When the installation completes, shutdown the Android virtual machine and unmount the iso image
- Plug in the Bluetooth USB adapter and add it to the Android Virtual Machine's settings
- Start the Android Virtual Machine and go through the start-up screens to configure Android for use
- In the Android VM go to the settings and enable BluetoothLE (if this fails reboot the VM and try to enable again)
Here are a few other links describing more or less the same method, and a few other tools that can be of interest to you:
And if you want this issue to be solved by Google, you can star this thread to make it more visible (with enough votes, Google will tackle it in a few years, as they did with audio issues...):