Troubleshooting
This page has two parts:
- Problems in your app: what the SDK reports, why, and how to fix it.
- Wearing, charging and pairing: links to the Corsano knowledge base, for the people who wear the bracelet.
All our troubleshooting links for wearers are available here: https://corsano.com/knowledge-base/
Problems in your app
The SDK reports a failure through the error channel of the call you made: the onError callback, a failed Result, a listener. Always log that Throwable: its class and message name the cause. The SDK also keeps its own logs, which you can export for Corsano support, see SDK logs.
| Symptom | Go to |
|---|---|
Every command fails with NotInitializedException | Commands fail with NotInitializedException |
A call fails with SdkLicenceException, or everything stopped working at once | SdkLicenceException |
| A command fails with another error | Other command errors |
| The scan finds no bracelet | The scan returns nothing |
| No data arrives in the database | Nothing downloads |
| Vital signs arrive, raw data (PPG2, accelerometer, BioZ) does not | Raw data does not arrive |
| A firmware update fails | A firmware update fails |
| The bracelet looks dead after a firmware update | The bracelet is stuck in its bootloader |
| The battery level is above 100 | Battery error detection |
Commands fail with NotInitializedException
Cause. From SDK 2.0.0 the bracelet must be initialized after every connection before it accepts commands. Until the bracelet initialization has finished on the current connection, the SDK rejects every command with NotInitializedException and does not send it. Only the commands of the initialization itself pass. BleDevice.isInitialized is false again after every disconnect.
Fix.
-
Call
enableAutoInitializationonce, when your app starts (inApplication.onCreate()). The SDK then initializes every bracelet each time it connects:DataSdk.getInstance().getManager().enableAutoInitialization(InitializationConfig(braceletPlan = DevicePlan.HOSPITAL_MULTICOLOR,samplingRate = SampleRate.ONE_MIN,)) -
A command you send right after the bracelet connects can still be too early. Wait for the initialization first:
manager.ensureInitialized(bleDevice)is a suspend function that returns a successfulResultwhen the bracelet is initialized. -
If it still fails, the initialization itself fails. Pass a
BraceletInitializationListenertoenableAutoInitializationand log itsonError. A configuration that the SDK refuses (see Bracelet Plans) is reported there too, and then no bracelet is initialized.
SdkLicenceException
Cause. The licence check locked the SDK. While it is locked, everything that reaches the bracelet or produces new data fails with SdkLicenceException, a scan ends at once with BleScanEvent.BleScanFailed (-32), a firmware update fails with DfuError.LICENCE_LOCKED (-32), and the automatic download stops. The data already on the phone stays readable.
Fix. Retrying the call does not help. Read SdkLicenceException.reason:
reason (LicenceError) | Fix |
|---|---|
PhoneDateInvalid | The phone's date is wrong. Ask the user to switch on the automatic date and time, then call DataSdk.recheckLicence(). |
Unknown | The Corsano cloud does not know your licence key. Check the key you pass in DataSdk.Config. |
Expired | The subscription of the key has ended or has not started. Contact Corsano. |
NotConfirmed | The phone has not reached the Corsano cloud (api.health.cloud.corsano.com) to confirm the key for two days. Give the phone a connection that reaches it, then call DataSdk.recheckLicence(). See Licence Key. |
NoLicenceKey | The SDK started without a licence key: your app does not include the data module, or removed its initialiser from the manifest. The ble and dfu modules do not work without it: add data and pass DataSdk.Config(licenceKey = ...). A recheck does not lift this lock. See Licence Key. |
The full description, the LicenceListener and DataSdk.licenceState are in Getting Started, Licence Key.
Other command errors
| Error | Cause | Fix |
|---|---|---|
PairingRequiredException | The bracelet answers that it is not paired with this phone. | Pair again, see Pairing. |
RuntimeException with the message "Watch disconnected" | The connection was lost while the command was waiting or running. | Wait until the bracelet is connected and initialized again, then send the command again. |
TimeoutCancellationException (from awaitCommandV2 with a timeout) | No answer within your timeout. A command for a bracelet that is not connected waits in the queue. | Check the connection state. Send the command again when the bracelet is connected. |
CommandResponseValidationException, InvalidCommandResponseException | The SDK could not use the bracelet's answer. Example: GetBatteryLevelRequest when the bracelet reports a battery error code instead of a level. | Log the message. If it stays, export the SDK logs for Corsano support. |
How commands are queued and how errors arrive is described in BLE SDK.
The scan returns nothing
Check these in order:
| Cause | How you see it | Fix |
|---|---|---|
| A runtime permission is missing | scanner.getMissingPermissions() is not empty | Request the permissions it returns, then scan. |
| Bluetooth is off | startScan throws IllegalStateException ("BluetoothLeScanner not found") | Ask the user to switch Bluetooth on. |
| A scan is already running | startScan throws IllegalStateException ("Scanning already started"); scanner.isScanning() is true | Call stopScan() first. |
| The SDK is locked by the licence check | The listener gets BleScanEvent.BleScanFailed with errorCode == BleScanFailed.LICENCE_LOCKED (-32) at once | See SdkLicenceException. |
| Android refused the scan | The listener gets BleScanEvent.BleScanFailed with one of Android's ScanCallback.SCAN_FAILED_* codes | Call stopScan(), then scan again. |
| You limited the device types | You passed deviceTypes to startScan without the type of your bracelet | Leave deviceTypes out. The default looks for the 287-1B, the 287-2B and bracelets that need recovery. |
| The bracelet is in its bootloader | It is reported with a scanType that has needsRecovery == true, without advertisementData | See The bracelet is stuck in its bootloader. |
You use startScanForPusherEvent | It only reports a bracelet whose button is being pressed | Ask the user to press the button, or use startScan. |
The scanning flow is described in Pairing.
Nothing downloads
The automatic download works like this: your app subscribes the bracelet once, the connected bracelet sends a ping every minute, and each ping starts a download. See Data transfer. When no data arrives, one of these is the cause:
| Cause | Fix |
|---|---|
| The bracelet was never subscribed. | Call subscribeDeviceForDownload(address, hardwareId, plan) once after pairing. The SDK stores the subscription and starts listening for pings again at every start of your app. |
| The bracelet is not connected, so no ping arrives. | Connect with connect(keepAlive = true), so that the SDK reconnects after a lost connection. See Pairing. |
The bracelet cannot be initialized. A download initializes the bracelet first, with the configuration of enableAutoInitialization. Without that call (and when you did not initialize the bracelet yourself on this connection) it fails, and the download is tried again later, without end. | Call enableAutoInitialization when your app starts. See Commands fail with NotInitializedException. |
The SDK is locked by the licence check. The download ends with SdkLicenceException, and triggerDownload does nothing. | See SdkLicenceException. |
| The bracelet is still pairing, or the phone is not authenticated with the bracelet. The SDK holds the downloads that a ping starts. | Finish the pairing. triggerDownload is not held back. |
| The last download started less than a minute ago. | Nothing: a ping starts at most one download per minute. |
| The bracelet is not connected and paired (bonded) in time. A download waits up to 30 seconds for that, then ends with an error. | Connect and pair the bracelet, see Pairing. |
You called unsubscribeDeviceForDownload or stopAll. | Subscribe again. |
To see why a download ended, add a completion listener. error is null after a successful download:
import com.corsano.sdk.data.DataSdk
import com.corsano.sdk.data.download.DeviceDownloadClient
val downloadManager = DataSdk.getInstance().getDownloadManager()
downloadManager.getDownloadClient(address, hardwareId, plan).addCompletionListener(
object : DeviceDownloadClient.DownloadCompletionListener {
override fun onDownloadFinished(address: String, error: Throwable?) {
if (error != null) Log.e("Corsano-SDK", "Download of $address failed", error)
}
}
)
Here hardwareId is a HardwareId and plan a DevicePlan, the same values you gave to subscribeDeviceForDownload.
Raw data does not arrive
The vital signs arrive but a raw file (PPG2, accelerometer, BioZ, ECG, raw temperature) or EmoGraphy does not:
| Cause | Fix |
|---|---|
| Your licence does not include this raw data. The automatic download then skips the file. | Ask Corsano what your licence includes. The phone must have been online for one start of your app after a change. See The licence and raw data. |
| The plan does not record it. | Choose a plan that does, see Bracelet Plans. |
| The accelerometer, or BioZ and EmoGraphy, is not switched on. | Set isAccEnabled or isBiozOrEmographyEnabled in the InitializationConfig. See Enable raw streams. |
| The bracelet is a 287-1B. The SDK downloads PPG2, EmoGraphy, BioZ, accelerometer, ECG, raw temperature and sleep from a 287-2B only. | Use a 287-2B. |
A firmware update fails
startDfu reports a failure in DfuListener.onDfuFailed(address, error). Look at error.errorCode:
errorCode | Cause | Fix |
|---|---|---|
DfuError.BRACELET_BATTERY_TOO_LOW (-30) | The bracelet's battery is below 30 %. Nothing was sent. | Charge the bracelet. Start again after at least 3 minutes. |
DfuError.START_FAILED (-31) | Android refused to start the DFU service, for example because your app was in the background. Nothing was sent. | Start again while your app is in the foreground. |
DfuError.LICENCE_LOCKED (-32) | The SDK is locked by the licence check. Nothing was sent. | See SdkLicenceException. |
| Another code | An error of the Nordic DFU library during the update, for example 4096: the bracelet disconnected. | Keep the phone near the bracelet and start again. If the bracelet no longer shows up in a normal scan, see the next section. |
startDfu itself throws in three cases:
| Exception | Cause | Fix |
|---|---|---|
IllegalStateException | An update is already in progress. | Wait for it to end; check getDfuState().isInProgress. |
IllegalArgumentException | The specific version cannot be installed on this hardware: it is unknown, it is in com.corsano.sdk:dfu-archive which your app excludes, or the bracelet is a 287-1B. | Check with FirmwareConfig.getSpecificVersion(hardwareId, version) first. |
Error | The hardware ID is not a 287-1B (51) or a 287-2B (54). | Check the hardware ID before you call the DFU methods. |
A 287-2B on firmware 9.42 or later cannot be downgraded to firmware 8.x or older. This is a rule of the firmware; the SDK does not check it before the update starts. Do not start such an update. The default firmware of SDK 3.0.0 is 9.50, so every 287-2B you update with startDfu(address, hardwareId) passes this point. See DFU SDK.
All statuses and errors are described in DFU SDK.
The bracelet is stuck in its bootloader
Symptom. After an interrupted firmware update the bracelet appears dead: lights off, even on the charger. Your app cannot connect to it, and a scan no longer reports it as a normal bracelet.
Cause. The update stopped midway (Bluetooth switched off, the app killed or removed from the recent apps, the bracelet's battery empty). The bracelet has no working firmware and waits in its bootloader.
Fix. Install the firmware again:
- Put the bracelet on its charger.
- Scan with
startScan. The bracelet is reported withscanTypeScanDeviceType.BRACELET_1B_NEED_RECOVERYorScanDeviceType.BRACELET_2B_NEED_RECOVERY(needsRecoveryistrue). - Call
CorsanoDfu.getInstance().startDfu(record.address, hardwareId)with the address of that scan record. The hardware ID is 51 forBRACELET_1B_NEED_RECOVERYand 54 forBRACELET_2B_NEED_RECOVERY. Do not connect or pair first.
The code is in DFU SDK, DFU recovery.