diff --git a/ble/src/main/java/no/nordicsemi/android/ble/BleManager.java b/ble/src/main/java/no/nordicsemi/android/ble/BleManager.java
index d22e2c86..2fcbcfd4 100644
--- a/ble/src/main/java/no/nordicsemi/android/ble/BleManager.java
+++ b/ble/src/main/java/no/nordicsemi/android/ble/BleManager.java
@@ -180,10 +180,12 @@ public BleManager(@NonNull final Context context, @NonNull final Handler handler
this.requestHandler = getGattCallback();
this.requestHandler.init(this, handler);
- ContextCompat.registerReceiver(context, mPairingRequestBroadcastReceiver,
- // BluetoothDevice.ACTION_PAIRING_REQUEST
- new IntentFilter("android.bluetooth.device.action.PAIRING_REQUEST"),
- ContextCompat.RECEIVER_EXPORTED);
+ if (isPairingSupported()) {
+ ContextCompat.registerReceiver(context, mPairingRequestBroadcastReceiver,
+ // BluetoothDevice.ACTION_PAIRING_REQUEST
+ new IntentFilter("android.bluetooth.device.action.PAIRING_REQUEST"),
+ ContextCompat.RECEIVER_EXPORTED);
+ }
}
/**
@@ -251,6 +253,16 @@ protected boolean isOptionalServiceSupported(@NonNull final BluetoothGatt gatt)
return requestHandler.isOptionalServiceSupported(gatt);
}
+ /**
+ * This method should return true if your want to be able to pair with
+ * the gatt device. If you return false, the pairing request BroadcastReceiver will
+ * not be registered.
+ */
+ protected boolean isPairingSupported() {
+ // Don't call super.isPairingSupported() when overriding this method.
+ return true;
+ }
+
/**
* In this method the manager should get references to server characteristics and descriptors
* that will use. The method is called after the service discovery of a remote device has
@@ -301,9 +313,9 @@ protected void onManagerReady() {
* Closes and releases resources. When the device disconnected with link loss and
* {@link ConnectRequest#shouldAutoConnect()} returned true you have to call this method to
* close the connection. If you intend to reuse this instance for multiple connections,
- * do not call this method after {@link #disconnect()}. If you are done with this instance,
+ * do not call this method after {@link #disconnect()}. If you are done with this instance,
* call this method from the {@link #disconnect()} completion handler, e.g.
- * disconnect().then { close() }.
+ * disconnect().then { close() }.
*/
public void close() {
try {