> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spikeapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Android SDK Changelog

> A changelog documenting version updates and changes of Spike SDK for Android platform.

## 4.7.12

* Removed the deprecated v1/v2 connection API

## 4.6.12

* Added Health Connect and Samsung Health Data nutrition support. You can now request nutrition permissions, backfill historical nutrition data, and include nutrition fields in background delivery by passing `nutritionalFields`.
  ```
  val nutritionalFields = setOf(
      NutritionalField.ENERGY_KCAL,
      NutritionalField.PROTEIN_G,
      NutritionalField.CARBOHYDRATE_G,
      NutritionalField.FAT_TOTAL_G
  )

  val permissions = spikeConnection.getHealthConnectPermissionManager().getPermissions(
      nutritionalFields = nutritionalFields
  )

  spikeConnection.backfill(
      nutritionalFields = nutritionalFields,
      days = 7
  )
  ```
* `getNutritionRecords(from, to)` now reads local Health Connect and Samsung Health Data nutrition data before returning nutrition records when those integrations are enabled.
* Nutrition uploads now include magnesium values when provided by Health Connect.

## 4.5.32

* Added Health Connect and Samsung Health Data nutrition support. Pass a `Set<NutritionalField>` to the Health Connect or Samsung Health Data permission manager to include the nutrition read permission in the request, and the same set is also accepted by `enableBackgroundDelivery`, `backfill`, and `BackgroundDeliveryConfig` so nutrition is uploaded alongside your other data. Once the nutrition permission is granted, `getNutritionRecords(from, to)` automatically pushes the latest local nutrition data before returning analyzed results.
  ```
  val permissions = spikeConnection.getHealthConnectPermissionManager().getPermissions(
      statisticsTypes = setOf(StatisticsType.STEPS),
      nutritionalFields = setOf(
          NutritionalField.ENERGY_KCAL,
          NutritionalField.PROTEIN_G,
          NutritionalField.CARBOHYDRATE_G,
          NutritionalField.FAT_TOTAL_G
      )
  )
  // ... after the user grants `permissions` via the Health Connect request contract ...
  val records = spikeConnection.getNutritionRecords(from = startDate, to = endDate)
  ```
  For Samsung Health Data, pass the same `nutritionalFields` set to `getSamsungHealthDataPermissionManager().getPermissions(...)`, `requestPermissions(...)`, or `requestPermissionsFromSamsungHealthDataAndBackfill(...)`.
* Updated Samsung Health Data to 1.1.0

## 4.5.22

* Added `backfill` on the v3 connection to upload historical health data for a chosen number of days. Call it after you have enabled Health Connect and/or Samsung Health Data integration (`enableHealthConnectIntegration()`, `enableSamsungHealthDataIntegration(...)`) and granted the permissions you need via the respective permission managers; then pass the statistics, metrics, activities, and sleep configurations you want to fill in. Only the categories you provide are pushed.
  ```
  spikeConnection.backfill(
      statisticsTypes = setOf(StatisticsType.STEPS),
      metricTypes = null,
      activityConfigs = null,
      sleepConfigs = null
  )
  ```
* Added `requestPermissionsFromSamsungHealthDataAndBackfill` — a convenience method that enables Samsung Health Data integration, requests permissions, and immediately starts backfilling historical data. Today and yesterday are pushed before the method returns so you can display data right away; older days continue uploading in the background.
  ```
  spikeConnection.requestPermissionsFromSamsungHealthDataAndBackfill(
      activity = this,
      statisticsTypes = setOf(StatisticsType.STEPS),
      metricTypes = null,
      activityConfigs = null,
      sleepConfigs = null,
      backfillDays = 7
  )
  ```
* Permission `PERMISSION_READ_HEALTH_DATA_HISTORY` is now added automatically to the list if required according to configuration in admin console.

## 4.5.12

* Improved handling of deleted integrations — background delivery is now automatically disabled when the integration no longer exists
* Improved error handling for API responses
* Added `RecordConfig` for configuring records queries:
  * `includeSamples` - whether to include samples (raw data points) in the response
* Updated `getRecords` to accept an optional `RecordConfig` parameter:
  ```
  spikeConnection.getRecords(
      types = metricTypes,
      from = startDate,
      to = endDate,
      filter = StatisticsFilter(excludeManual = true),
      config = RecordConfig(includeSamples = true)
  )
  ```

## 4.4.12

* Updated `Unit` enum with new values:
  * Added: `miles`, `mPerSec`, `fahrenheit`, `ms`, `seconds`, `degrees`, `sleepStage`, `secPerM`, `rpm`, `spm`, `breathsPerMin`, `g`, `lbs`, `st`, `mmHg`, `mLPerKgPerMin`, `uV`, `mgPerDl`, `w`
  * Removed: `kmh`, `kmPerMin`
* Improved data communication with API
* Enhanced the `getSleep` endpoint.
  Important:
  * Dates provided are now interpreted as dates only; the time component is ignored when querying the API.
  * The primary night sleep period is associated with the calendar date on which it ends.

## 4.3.142

* Internal improvements and bug fixes.

## 4.3.132

* Samsung Health Data Integration - Major Expansion:
  * Added support for reading and pushing the following data types from Samsung Health:
    * Workouts (exercises)
    * Sleep data
    * Body composition data (weight, height, BMI, body fat)
    * User profile data (weight, height, birth date, gender)
    * Blood pressure measurements
    * Skin temperature measurements
    * Heart rate measurements
    * Blood oxygen saturation (SpO2) measurements
    * Body temperature measurements
  * More efficient Samsung Health Data pushes
  * Large Samsung Health Data pushes are now automatically split into smaller chunks for reliable delivery
* Health Connect Improvements:
  * Large Health Connect pushes are now automatically split into smaller chunks for reliable delivery

## 4.3.122

* Added Nutrition Facts Label Recognition for extracting nutritional information from label photos.
  For more information please visit our [documentation](https://docs.spikeapi.com).
  * `recognizeNutritionFactsLabel(imageBase64, config)` - Analyze a nutrition facts label image and extract nutritional data
  * `recognizeNutritionFactsLabel(image: Bitmap, config)` - Convenience method that accepts Bitmap

* Added methods for manual nutrition record management:
  * `createNutritionRecord(nutritionRecord)` - Insert a new nutrition record with custom data
  * `replaceNutritionRecord(nutritionRecord)` - Replace an existing nutrition record completely

* Added `NutritionRecordUtils` for creating and manipulating nutrition records:
  * `NutritionRecordUtils.create(...)` - Create a new nutrition record with specified properties
  * `NutritionRecord.withIngredient(ingredient)` - Add an ingredient to a record
  * `NutritionRecord.withoutIngredient(ingredient)` - Remove an ingredient from a record
  * `NutritionRecord.withServingSize(servingSize, unit)` - Update serving size and unit

* Added `NutritionRecordIngredientUtils` for creating and manipulating ingredients:
  * `NutritionRecordIngredientUtils.create(...)` - Create a new nutrition record ingredient
  * `NutritionRecordIngredient.withNutritionalField(field, value)` - Set a nutritional field value
  * `NutritionRecordIngredient.withoutNutritionalField(field)` - Remove a nutritional field
  * `NutritionRecordIngredient.withScaledServingSize(newServingSize)` - Scale serving size and nutritional values proportionally

* Nutrition AI methods now return `NutritionRecordAnalysisResult` instead of `NutritionRecord`.
  The new `NutritionRecordAnalysisResult` contains:

  * `recordId` - The record ID
  * `status` - Processing status (pending, processing, completed, failed, updated)
  * `failureReason` - Reason for failure (if status is failed)
  * `uploadedAt` - Upload timestamp
  * `nutritionRecord` - The actual nutrition data (nullable, only present when status is completed/updated)
    **Affected methods:**
  * `analyzeNutrition(...)` - Now returns `NutritionRecordAnalysisResult`
  * `getNutritionRecords(from, to)` - Now returns `List<NutritionRecordAnalysisResult>`
  * `getNutritionRecord(id)` - Now returns `NutritionRecordAnalysisResult?`
  * `updateNutritionRecordServingSize(id, servingSize)` - Now returns `NutritionRecordAnalysisResult`
  * `createNutritionRecord(nutritionRecord)` - Now returns `NutritionRecordAnalysisResult`
  * `replaceNutritionRecord(nutritionRecord)` - Now returns `NutritionRecordAnalysisResult`

  Access the nutrition data via the `nutritionRecord` property:

  ```kotlin theme={null}
  val result = spikeConnection.analyzeNutrition(image)
  val dishName = result.nutritionRecord?.dishName // Previously: result.dishName
  val status = result.status // Status is now on the result object
  ```

* `NutritionRecord` no longer contains `status` and `failureReason` properties.
  These properties have been moved to `NutritionRecordAnalysisResult`.

## 4.3.112

* Added Nutrition AI features for analyzing food images. For more information
  please visit our [documentation](https://docs.spikeapi.com).
  * `analyzeNutrition(imageBase64, consumedAt, config)` - Analyze food image synchronously and wait for results
  * `analyzeNutrition(image: Bitmap, consumedAt, config)` - Convenience method that accepts Bitmap
  * `submitNutritionForAnalysis(imageBase64, consumedAt, config)` - Analyze food image asynchronously, returns record ID
  * `submitNutritionForAnalysis(image: Bitmap, consumedAt, config)` - Convenience method that accepts Bitmap
  * `getNutritionRecords(from, to)` - Retrieve nutrition records for a date range
  * `getNutritionRecord(id)` - Get a specific nutrition record by ID
  * `deleteNutritionRecord(id)` - Delete a nutrition record
  * `updateNutritionRecordServingSize(id, servingSize)` - Update serving size for a nutrition record
* Added new `Provider`:
  * LUNA
* Added new `ProviderSource` types:
  * FITBIT\_SKIN\_TEMPERATURE\_SUMMARY
  * GARMIN\_WELLNESS\_SKIN\_TEMPERATURE\_SUMMARY
  * LUNA\_SLEEP
* Removed `ProviderSource` types:
  * FITBIT\_USER\_ACTIVITIES\_LIST
  * FITBIT\_USER\_ACTIVITIES\_DATE
  * FITBIT\_USER\_ACTIVITIES\_HEART\_DATE
  * FITBIT\_USER\_ACTIVITIES\_HEART\_DATE\_INTERDAY
  * WITHINGS\_MEASURE\_GET\_WORKOUTS
  * WITHINGS\_MEASURE\_GET\_ACTIVITY
  * WITHINGS\_MEASURE\_GET\_MEAS
* Removed `ActivityTag`:
  * ON\_BICYCLE
* Removed `Provider`:
  * WAHOO

## 4.3.102

* Enable Health Connect integration in admin console right after enabling integration
* Enable Samsung Health Data integration in admin console right after enabling integration
* 🔴 **Breaking Change**: `enableHealthConnectIntegration()` is now a suspend function. Update your code to call it from a coroutine scope.
* 🔴 **Breaking Change**: `enableSamsungHealthDataIntegration()` is now a suspend function. Update your code to call it from a coroutine scope.

## 4.3.92

* Updated Health connect to `1.1.0-rc03`
* Updated compileSdk to `36`
* Updated gradle to `8.13`
* Removed `providerUserIdentifier` from `IntegrationInitConfig`
* Added ability to read mindfulness activities:

```
if (spikeConnection.getHealthConnectPermissionManager()
                   .isFeatureAvailable(feature: HealthConnectFeature.FEATURE_MINDFULNESS_SESSION)) {
    spikeConnection.getActivities(
        config: ActivityConfig(activityCategories: [ActivityCategory.MINDFULNESS])
        from: dateFrom,
        to: dateTo
    )
}
```

* Added new `ActivityTag` types:
  * MINDFULNESS
* Added new `ActivityType` types:
  * ECG\_MEASUREMENT
  * TRIATHLON
  * BIATHLON
  * DUATHLON
  * ROLLERBLADING
  * SKATEBOARDING
  * SKATING
  * CALISTHENICS
  * WEIGHT\_LIFTING
  * CANOEING
  * FLOORBALL
  * JIU\_JITSU
  * DIVING
  * ORIENTEERING
  * BOOTCAMP
  * MOTORSPORTS
  * HORSERIDING
  * PARAGLIDING
  * MULTISPORT
  * BLOOD\_TEST
  * MINDFULNESS\_SESSION
* Added new `ProviderSource` types:
  * APPLE\_HEALTHKIT\_MINDFULNESS
  * HEALTH\_CONNECT\_MINDFULNESS\_SESSION
* Added new `ActivityCategory` type:
  * MINDFULNESS
* Added new `HealthConnectFeature`:
  * FEATURE\_MINDFULNESS\_SESSION
* Added new `MetricType`:
  * HEARTRATE\_RESTING\_MIN
  * HEARTRATE\_RESTING\_MAX
  * CADENCE
  * CADENCE\_MIN
  * CADENCE\_MAX
  * PACE
  * AIR\_TEMPERATURE
  * BODY\_TEMPERATURE\_MAX
  * BODY\_TEMPERATURE\_MIN
  * BASAL\_BODY\_TEMPERATURE
  * BASAL\_BODY\_TEMPERATURE\_MAX
  * BASAL\_BODY\_TEMPERATURE\_MIN
  * SKIN\_TEMPERATURE\_MAX
  * SKIN\_TEMPERATURE\_MIN
  * SLEEP\_SKIN\_TEMPERATURE\_DEVIATION
* Added new `StatisticsType`:
  * SLEEP\_SKIN\_TEMPERATURE\_DEVIATION
  * HRV\_RMSSD
  * HRV\_SDNN

## 4.3.82

* Workaround for the Android 15 bug to make background delivery more resilient
* Implemented more efficient pushes to Spike API

## 4.3.72

* Allow reading `SPO2` and `SWIMMING_LENGTHS` in `getActivities`
* Allow reading `SPO2` and `SKIN_TEMPERATURE` in `getSleeps`

## 4.3.62

* Optimized background delivery

## 4.3.52

* Added `Provider.COROS`
* Updated `ProviderSource` enum
* Added new Statistic types:
  * STRESS\_SCORE
  * RECOVERY\_SCORE
  * ACTIVITY\_SCORE
* Added new Metric types for `getSleep` request:
  * SLEEP\_DURATION
  * SLEEP\_DURATION\_AWAKE
  * SLEEP\_DURATION\_DEEP
  * SLEEP\_DURATION\_LIGHT
  * SLEEP\_DURATION\_NAP
  * SLEEP\_DURATION\_REM
  * SLEEP\_EFFICIENCY
  * SLEEP\_INTERRUPTIONS
  * SLEEP\_LATENCY
  * SLEEP\_SCORE

## 4.3.42

* Added new `MetricType.GLUCOSE` available in both Health Connect and Samsung Health
* Updated Samsung Health Data SDK to version 1.0.0 (available only on Android 29+)

## 4.3.32

* Switched to protobuf java-lite 3.25.5 for better compatibility with firebase
* The old SpikeSDK API has been deprecated

## 4.3.22

* Added DISTANCE\_SWIMMING into the list of metrics available in activities
* Added new providers: DEXCOM, FREESTYLE\_LIBRE, HUAWEI, STRAVA

## 4.3.12

* Added new statistics for Health Connect:
  * HEARTRATE
  * HEARTRATE\_MAX
  * HEARTRATE\_MIN
* Added new metrics for Health Connect:
  * HEARTRATE
  * HEARTRATE\_MAX
  * HEARTRATE\_MIN
* Improved transport protocol for even faster requests to Spike API
* Added Samsung Health Integration for:
  * `StatisticType`s:
    * STEPS
    * DISTANCE\_TOTAL
    * CALORIES\_BURNED\_ACTIVE
    * CALORIES\_BURNED\_TOTAL
    * CALORIES\_BURNED\_BASAL
* Added new `Provider`:
  * SAMSUNG\_HEALTH\_DATA
* Added new `ProviderSource`:
  * SAMSUNG\_HEALTH\_DATA\_AGGREGATION
* Renamed `MetricType`s:
  * SLEEP\_BREATHING\_RATE to BREATHING\_RATE
  * SLEEP\_BREATHING\_RATE\_MIN to BREATHING\_RATE\_MIN
  * SLEEP\_BREATHING\_RATE\_MAX to BREATHING\_RATE\_MAX

## 4.2.82

* Added `IntegrationInitConfigUtils` for usage in Flutter and React Native libraries
* Additional check in `getIntegrationInitUrl` for email in ultrahuman integration

## 4.2.72

* Added new `MetricType`s:
  * BODY\_FAT
  * BODY\_FAT\_MAX
  * BODY\_FAT\_MIN
  * BODY\_BONE\_MASS
  * BODY\_MASS\_INDEX
  * BLOOD\_PRESSURE\_SYSTOLIC
  * BLOOD\_PRESSURE\_SYSTOLIC\_MIN
  * BLOOD\_PRESSURE\_SYSTOLIC\_MAX
  * BLOOD\_PRESSURE\_DIASTOLIC
  * BLOOD\_PRESSURE\_DIASTOLIC\_MIN
  * BLOOD\_PRESSURE\_DIASTOLIC\_MAX
* Added new fields in `UserProperties`:
  * BODY\_FAT
  * BODY\_BONE\_MASS
  * BODY\_MASS\_INDEX
* Updated `getIntegrationInitUrl`. Now it accepts `IntegrationInitConfig` config object where you can pass:
  * `redirectUri`: will override the one set in admin console
  * `state`: when the authorization server redirects back to the client, it includes the `state` value originally sent
  * `providerUserIdentifier`: at the moment used (and required) only when integrating with ultrahuman
* Added new provider: `ultrahuman`
  When integrating with Ultrahuman, you have to provide Ultrahuman user email in `IntegrationInitConfig.providerUserIdentifier`. Example:
  ```
  spikeConnection.getIntegrationInitUrl(provider = Provider.ULTRAHUMAN, config = IntegrationInitConfig(providerUserIdentifier = "user@mail.com"))
  ```

## 4.2.62

* Added consumer proguard rules

## 4.2.52

* New statistics:
  * HEARTRATE\_RESTING
  * SLEEP\_DURATION\_TOTAL
* New statistics (only from non-HealthConnect providers):
  * HEARTRATE
  * HEARTRATE\_MIN
  * HEARTRATE\_MAX
* Metric types updates
* Better proguard settings for uniqueness of generated class names
* Fix for statistics in different time zones

## 4.2.42

* New metrics:
  * SPO2
  * BODY\_TEMPERATURE
  * SKIN\_TEMPERATURE
  * SLEEP\_BREATHING\_RATE (available only on getSleep())
  * SLEEP\_BREATHING\_RATE\_MIN (available only on getSleep())
  * SLEEP\_BREATHING\_RATE\_MAX (available only on getSleep())
  * SLEEP\_BREATHING\_RATE\_AVG (available only on getSleep())
* Added sleepScore property in the Record type

## 4.2.32

* New `getUserProperties` method for reading: weight, height, timezone from Health Connect
* New `getUserProperties` method for reading: birthdate, gender from other providers
* New metric: `VO2MAX` available in `getRecords` and `getActivities`
* New statistic: `SLEEP_SCORE`

## 4.2.22

* Implemented better API error handling
* Exposed `SpikeHMACSignatureGenerator` for debugging purposes

## 4.2.12

* 🔴 **Breaking Change**: Update to `SpikeConnectionAPIv3.createConnection`. The method

  `SpikeConnectionAPIv3.createConnection(context:, appId:, authToken:, customerEndUserId:)` has been updated to:

  `SpikeConnectionAPIv3.createConnection(context:, applicationId:, signature:, endUserId:)`

* The `applicationId` parameter must now be provided as an **`Int`**.

* The `signature` parameter now requires an **`HMAC-SHA256` signed user ID**.

* ⚠️ **Security Notice:**
  * **Do not store your HMAC signing key within the application itself**, as this poses a security risk.
  * Instead, generate and provide the signature from your backend.

* **Legacy Support**: For **development purposes only**, the previous connection flow remains available under the renamed method:
  `SpikeConnectionAPIv3.createConnectionLegacy(context:, appId:, authToken:, customerEndUserId:)`

## 4.1.12

* Added background delivery (see documentation for more information)
* Health Connect library updated to 1.1.0-alpha11
* Compile SDK and target SDK updated to 35
* Updated kotlin version to 1.9.25
* Updated other dependencies
* Added log callback
* Updated gradle to 8.8.0

## 4.0.22

Renamed `getProviderIntegrationUrl` to `getIntegrationInitUrl` to be on par with other platforms

## 4.0.12

Completely new SDK! Please see our official documentation for more details and usage instructions

## 3.1.6

* Updated steps intraday to better check for manual entries
* Added permissions specific to steps\_intraday

## 3.1.5

* Implemented checking for permissions before reading additional sleep data

## 3.1.4

* Added metadata in Calories raw data

## 3.1.3

* Reverted 3.1.2 changes

## 3.1.2

* Added third party integration initialization

## 3.1.1

* Removed unneeded settings from android manifest

## 3.1.0

* Better way to authenticate with API
* Added saved session validation before the connection is established
* Added customer user id validation.

## 3.0.19

* Added safeguard for to handle multiple sources of sleep data and avoid illogical values

## 3.0.18

* Added new logic for detecting changes in intraday\_steps metadata

## 3.0.17

* Removed the limitation that prevented values from being sent when the requested period is more than a day
* Implemented calculation of time by sleep stage in sleep data

## 3.0.16

* Updated metadata info in intraday\_steps to have all values as single objects
* Refactored how the decision whether to send metadata with intraday\_steps is made

## 3.0.15

* Added all metadata info to each intraday\_steps data object

## 3.0.14

* Fixed sleep time counting by different stages

## 3.0.13

* Added a source field to the sleep data class

## 3.0.11

* Fixed data type StepsIntraday handling

## 3.0.9

* Added a new Spike data type — `IntradaySteps`

## 3.0.8

* Updated the package checker function to avoid unnecessary checks for Android 14 and up versions.

## 3.0.7

* Can get permission contract before SpikeConnection is created

## 3.0.6

* Moved permission checking before data extraction to the SDK connection layer

## 3.0.5

* Fixed extraction of heart data

## 3.0.4

* Added support for Android 14
* Updated Readme to match the Android 14 implementation process
* Fixed some issues with data requesting for a specified date range

## 3.0.2:

* Activity summary and activity stream can be called without granting all their permissions. Returned data depends on which permissions were provided.
* Permission requests are divided by datatypes.
* Works up to Android 13.
