Skip to main content

SDK logs and debugging

SDK Logs​

Available starting SDK 0.8.0

What are the SDK Logs?​

The SDK logs is a zip file (logs_<date>.zip) that the SDK makes on request. It contains:

  • SDK logs: .txt files with technical information from the SDK, like the actions performed by the SDK and the BLE scan / communication. One file per day (sdk_logs<yyyyMMdd>.txt).
  • Bracelet logs: .txt files with technical information from the firmware, like commands received / sent, connection status and firmware actions. One file per day (watch-<yyyyMMdd>.txt). The bracelet's log is fetched by the automatic download, so these files only exist when it runs.
  • Sleep files: the .wiff files in the app's internal sleep folder, when there are any.
  • Two CSV files with the activity and temperature raw metrics of the last 5 days (export-activity-raw-data.csv, export-temperature-raw-data.csv).

With these files the Corsano team will be able to investigate any situation.

note

The SDK keeps the log files of the last 5 days and deletes older ones. We can only investigate a situation in this range, so export the logs soon after a problem.

The SDK logs do not contain the licence key (since 3.0.0), nor the body of the SDK usage report.

How to implement it​

Here is how to add the export of the logs to your application:

From SDK 1.1.20

DataSdk.getInstance().getManager().getLogs(context, docFile)

Before SDK 1.1.20

CorsanoSdk.getLogs(requireContext(), docFile)

CorsanoSdk.getLogs is deprecated: use the call on the manager.

docFile is a folder the user has selected and given your app access to. Full sample code:

private val pickFolder =
registerForActivityResult(ActivityResultContracts.OpenDocumentTree()) { uri ->
val docFile = uri?.let { DocumentFile.fromTreeUri(requireContext(), it) }
?: return@registerForActivityResult
DataSdk.getInstance().getManager().getLogs(requireContext(), docFile)
}

// When the user taps "Export logs":
pickFolder.launch(null)

The sample app does the same in RecentDevicesFragment.kt.

This creates one .zip file in the selected folder, with all the technical information that we need for the support.

  • getLogs returns at once. The zip file is made in the background and has no callback: look for the new logs_<date>.zip in the folder. A failure is only written to the SDK's log.
  • The logs contain a maximum of 5 days of history.
  • Since 3.0.0 getLogs and exportData can run at the same time.

Please send it to us via our contact page

SDK debugging​

To see the SDK's log lines in Logcat while you develop, set a logger: see Logger configuration.

Export the database​

The database content is very useful to debug. Since SDK 3.0.0 the SDK stores its data in a Room (SQLite) database, corsano-sdk-local.db. In Android Studio it can be found in:

Device File Explorer > data > data > <your.application.id> > databases > corsano-sdk-local.db (in the sample app, com.corsano.sdk.sample)

Copy the corsano-sdk-local.db-wal and corsano-sdk-local.db-shm files next to it as well. The file is plain SQLite, unless your app passes a databaseOpenHelperFactory that encrypts it: then it can only be opened with your key. See Storage.

Up to SDK 2.3.0 the database was the Realm file corsano-sdk-local-raw.realm in the files folder of the app.

SDK extended temperature data​

Available starting SDK 1.1.6

What are the extended temperature data?​

Extended temperature data are the raw values of the temperature sensor (skin temperature, heat flux and more), stored as MetricTemperatureRaw. They provide additional insights that are crucial for the Corsano team to investigate any issues or feedback related to temperature measurements.

warning

We can only thoroughly investigate temperature-related feedback if this extended data is available.

How to use​

What must be in place:

  1. The bracelet is a 287-2B.
  2. Your licence includes the raw temperature. See The licence and raw data.
  3. The collection is enabled on the bracelet (below).
  4. The bracelet is subscribed for the automatic download.

Enable / Disable​

To enable or disable the extended temperature data collection, send this command to the connected and initialized bracelet:

import com.corsano.sdk.ble.BleSdk
import com.corsano.sdk.ble.command.enqueueCommand
import com.corsano.sdk.ble.command.request.SetTemperatureRawPlan
import com.corsano.sdk.ble.data.VitalParameterValue

val bleDevice = BleSdk.getInstance().getDevice(address)

val value = if (isChecked) VitalParameterValue.CONTINUOUS else VitalParameterValue.DISABLE
bleDevice.enqueueCommand(
SetTemperatureRawPlan(value),
{
result("Set Temperature raw $value OK")
},
{
result("Set Temperature raw $value error $it")
})

GetTemperatureRawPlan() reads the setting back.

The data is then synchronized by the automatic download. Each time new records are stored, the SDK calls the metricTemperatureRawUpdated listener of the manager with them; read the stored records from metricTemperatureRawRepository. See Retrieve the Data.

Export the data​

CSV export functionality is available here.

Use ExportType.TEMPERATURE_RAW to export the extended temperature data.

Delete the data​

Since this data can grow large quickly, it's recommended to delete it regularly:

DataSdk.getInstance().getManager().metricTemperatureRawRepository.deleteAll()