react-native-ble-manager 8.1.0 → 8.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -732,4 +732,19 @@ class BleManager extends ReactContextBaseJavaModule {
732
732
  // Keep: Required for RN built in Event Emitter Calls.
733
733
  }
734
734
 
735
+ @Override
736
+ public void onCatalystInstanceDestroy() {
737
+ try {
738
+ // Disconnect all known peripherals, otherwise android system will think we are still connected
739
+ // while we have lost the gatt instance
740
+ disconnectPeripherals();
741
+ }catch(Exception e) {
742
+ Log.d(LOG_TAG, "Could not disconnect peripherals", e);
743
+ }
744
+
745
+ if (scanManager != null) {
746
+ // Stop scan in case one was started to stop events from being emitted after destroy
747
+ scanManager.stopScan(args -> {});
748
+ }
749
+ }
735
750
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-ble-manager",
3
- "version": "8.1.0",
3
+ "version": "8.2.0",
4
4
  "description": "A BLE module for react native.",
5
5
  "main": "BleManager",
6
6
  "types": "./index.d.ts",