Android 在Nexus 5中找不到心率服务
在Android版本为6.0.1的Google Nexus 5中找不到UUID为“0000180d-0000-1000-8000-00805f9b34fb”且特征为“00002a37-0000-1000-8000-00805f9b34fb”的服务。在像素XL中找不到相同的 但三星Galaxy On5 Pro和安卓6.0.1版也有同样的功能 心率服务是否仅适用于某些特定设备?下面是我用来检测心率服务的代码Android 在Nexus 5中找不到心率服务,android,bluetooth-lowenergy,Android,Bluetooth Lowenergy,在Android版本为6.0.1的Google Nexus 5中找不到UUID为“0000180d-0000-1000-8000-00805f9b34fb”且特征为“00002a37-0000-1000-8000-00805f9b34fb”的服务。在像素XL中找不到相同的 但三星Galaxy On5 Pro和安卓6.0.1版也有同样的功能 心率服务是否仅适用于某些特定设备?下面是我用来检测心率服务的代码 @Override public void onServicesDiscovered(Blu
@Override
public void onServicesDiscovered(BluetoothGatt gatt, int status) {
if (status == BluetoothGatt.GATT_SUCCESS) {
//broadcastUpdate(ACTION_GATT_SERVICES_DISCOVERED);
for (BluetoothGattService gattService : gatt.getServices()) {
Log.i(TAG, "Service UUID Found: " + gattService.getUuid().toString());
for (int k = 0; k < gattService.getCharacteristics().size(); k++) {
Log.v(TAG, "CHARACTERISTIC____: " + gattService.getCharacteristics().get(k).getUuid());
if (gattService.getCharacteristics().get(k).getUuid().equals(UUID_HEART_RATE_MEASUREMENT)) {
flag = true;
BluetoothGattCharacteristic heartRate = gattService.getCharacteristic(UUID_HEART_RATE_MEASUREMENT);
setCharacteristicNotification(heartRate, true);
return;
} else {
Log.d(TAG, "Unable to find heart rate sevice");
}
}
}
if (!flag) {
flag = false;
broadcastUpdate(ACTION_GATT_SERVICES_DISCOVERED);
}
} else {
Log.w(TAG, "onServicesDiscovered received: " + status);
}
}
@覆盖
发现服务上的公共无效(Bluetooth gatt,int状态){
如果(状态==蓝牙GATT.GATT\U成功){
//广播更新(发现行动、关税及贸易总协定服务);
for(BluetoothGattService gattService:gatt.getServices()){
Log.i(标记“找到的服务UUID:+gattService.getUuid().toString());
对于(int k=0;k
请帮助我检测Nexus 5设备上的心率服务及其特征 我不确定,但我认为这是三星健康套件提供的服务。(预安装在三星设备上)尝试在Nexus 5上安装三星健康应用程序,然后重试您的代码。@Nico仍然相同。。安装三星健康应用程序后仍无法工作