Overview
The Validic SDK
...
With that said, there are some things you can do to disconnect the SDK from listening for readings in the background and additional steps you could take in your app to guide the user to the BLE settings in their OS and allow them to take the action of removing the device from the phone’s settings.
How do I get the SDK to stop listening passively to the device?
If you have enabled passive listening to your integration of the SDK, then you would want to take a look at the passive read elements of the BLE integration. The net effect when you stop listening is you do not receive readings in the background from that device. It does continue to display as a paired Bluetooth device in the phone's settings if the device supports that level of pairing.
- To stop monitoring peripherals in the background set the background peripherals to an empty set
cannot directly unpair Bluetooth devices from phones - this must be done by the end-user through their device settings
On iOS, even programmatic unpairing via settings is not possible due to Apple's security model
However, there are two key actions you can take in your app:
Stop the SDK from passively listening for device readings
Guide users to their device's Bluetooth settings to manage device connections
Stopping Passive Device Listening
To prevent the SDK from receiving background readings from a device, use the appropriate code for your platform:
Android Native
Code Block |
---|
java |
Copy
Code Block |
---|
PassiveBluetoothManager.getInstance().setPassivePeripherals(Collections.emptySet()); |
...
...
iOS Native
Code Block |
---|
swift |
Copy
Code Block |
---|
VLDBluetoothPassiveManager.sharedInstance().peripheralIDs = nil |
Cordova
Code Block |
---|
javascript |
Copy
Code Block |
---|
ValidicMobile.BLE.setPassiveReadPeripheralIDs({
peripheralIDs: [] |
...
}); |
Xarmin Android Framework Wrapper
...
Xamarin Android
Code Block |
---|
csharp |
Copy
Code Block |
---|
PassiveBluetoothManager.Instance.PassivePeripherals = null; |
...
Xamarin iOS
Code Block |
---|
csharp |
Copy
Code Block |
---|
VLDBluetoothPassiveManager.SharedInstance().PeripheralIDs = null; |
Prompt the end user to disable the BLE connection to the device in their OS settings
Additionally, you could build a function in your app that once you tell the SDK to stop listening for the device you could remind the user to remove it from their BLE connections. You could even launch them over to BLE settings from your app. This will allow the end user to give their consent to remove the device from the phone’s settings by taking the action themselvesNote: After stopping passive listening:
The SDK will no longer receive readings in the background
The device will still appear as paired in the phone's Bluetooth settings
The device can still be used for foreground readings if needed
User Experience Recommendations
Implement a "Remove Device" option in your app that:
Stops SDK passive listening using the code above
Shows instructions for removing the device from phone settings
Provides a direct link to the device's Bluetooth settings
Add clear user education explaining:
Why they might want to remove a device
The two-step process (stopping readings in-app and removing from phone settings)
The difference between stopping readings and fully unpairing
This separation of concerns ensures users maintain control over their device connections while allowing your app to properly manage SDK device monitoring.