我按照提示指南创建了一个简单的应用程序来使用三星 BLE SDK http://developer.samsung.com/ble#扫描 BLE 设备:
public void onCreate() {
if (mBtAdapter == null) {
mBtAdapter = BluetoothAdapter.getDefaultAdapter();
if (mBtAdapter == null) return;
}
BluetoothGattAdapter.getProfileProxy(this, mProfileServiceListener, BluetoothGattAdapter.GATT);
.
.
.
private BluetoothProfile.ServiceListener mProfileServiceListener = new BluetoothProfile.ServiceListener() {
public void onServiceConnected(int profile, BluetoothProfile proxy) {
if (profile == BluetoothGattAdapter.GATT) {
mBluetoothGatt = (BluetoothGatt) proxy;
mBluetoothGatt.registerApp(mGattCallbacks);
}
}
}
然后打电话
mBluetoothGatt.startScan();
按下按钮。
当我在 Gear 上运行应用程序时,一切都会正确实例化,但回调
onScanResult(BluetoothDevice device, int rssi, byte[] scanRecord)
永远不会被调用。当我在三星 GT-N5110 平板电脑上运行应用程序时,一切正常,我可以看到该区域的所有设备。
任何想法为什么这在 Gear 上不起作用?