Android 21 API 中的 BLE 广告模式

BLE Advertisement mode in Android 21 API

我正在使用 Moto G 2013 和 Nexus 5,需要将它们用作 BLE(低功耗蓝牙)广告商。 Android API 21 添加了此功能,并且两个设备都是 运行 Android 5 Lollipop。

事实是,我相信硬件支持 BLE 广告,但我已经阅读过,似乎 Google 在 Nexus 5 中放弃了对 BLE 广告的支持,但我找不到关于 Moto 的任何信息G.

应该调用 this 方法来检查是否支持 BLE 广告,我是这样做的:

    BluetoothManager btManager = (BluetoothManager) getSystemService(BLUETOOTH_SERVICE);
    BluetoothAdapter btAdapter = btManager.getAdapter();

     if(btAdapter.isMultipleAdvertisementSupported()){
            //Do Stuff
        }
        else{
            //Do other stuff
        }

在 Moto G 和 Nexus 5 中,该方法 returns 错误。

有没有人有办法解决这个问题(或额外信息)?

关闭此更新:

这仅适用于具有 SDK21 的两种设备:Nexus 6 和 Nexus 9。其他设备不work/weren不支持。

我最终使用了 Nexus 9。

来自here(原link已死):

We introduced BLE peripheral mode in Android 5.0 Lollipop. Nexus 6 and Nexus 9 are the first two production Nexus devices that support BLE peripheral mode. Due to hardware chipset dependency, older Nexus devices (4/5/7) will not have access to the feature on Lollipop.