不是在这个版本,但有证据表明它即将推出。
如果你在android-19源代码中查看BluetoothGatt.java,那么在android-18中不存在新的方法listen
和setAdvData
。
但是这些都没有记录,因为我不认为本地支持是完整的。最后一次检查AOSP的外设模式标题为“LE:添加外设角色支持(2/4)”。此外,setAdvData
和listen
有这样的代码:
if (mContext == null || !mContext.getResources().getBoolean(com.android.internal.R.bool.config_bluetooth_le_peripheral_mode_supported))
{
throw new UnsupportedOperationException("BluetoothGatt#listen is blocked");
}
从Android来源的Android展望/ platform_frameworks_base/BLOB /主/核心/ RES/RES /价值/ config.xml中你可以看到,这是当前已禁用:
<!-- Boolean indicating if current platform supports BLE peripheral mode -->
<bool name="config_bluetooth_le_peripheral_mode_supported">false</bool>
还不是我猜:https://code.google.com/p/android/issues/detail?id=59693 – Slartibartfast
感谢哥们。该请求在4.4版发布之前。我还评论说希望看到4.4中的一些变化。你知道有没有其他方法可行? –
不知道你可以解决它不幸的是,外设是更多的网络架构/硬件相关。也许你可以看看GATT服务器/客户端的东西,并试图破解一些东西(不是真的推荐,但嘿绝望的时候正确:))。但看起来黯淡,直到他们把它拿出来 – Slartibartfast