Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/android/BluetoothLePlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -1768,6 +1768,15 @@ private boolean subscribeAction(JSONArray args, CallbackContext callbackContext)
return false;
}

result = bluetoothGatt.setCharacteristicNotification(characteristic, true);

if (!result) {
addProperty(returnObj, keyError, errorSubscription);
addProperty(returnObj, keyMessage, logSubscribeFail);
callbackContext.error(returnObj);
return false;
}

AddCallback(characteristicUuid, connection, operationSubscribe, callbackContext);

//Write the descriptor value
Expand Down Expand Up @@ -1856,6 +1865,15 @@ private boolean unsubscribeAction(JSONArray args, CallbackContext callbackContex
return false;
}

result = bluetoothGatt.setCharacteristicNotification(characteristic, false);

if (!result) {
addProperty(returnObj, keyError, errorSubscription);
addProperty(returnObj, keyMessage, logSubscribeFail);
callbackContext.error(returnObj);
return false;
}

AddCallback(characteristicUuid, connection, operationUnsubscribe, callbackContext);

//Write the actual descriptor value
Expand Down