Your app, Powered by EXI Exercise Intelligence
Our personalised physical activity prescription, your app.
Get up and running with SDKs, API keys and integration tools.
Android EXI® SDK Functions Guide
Add EXI® to your applications
Learn how to create an EXI® powered Android application and integrate the EXI® SDK into your products and platforms.
Get Health Conditions
suspend fun getHealthConditions(): Result<EXIError, List<EXIHealthCondition>>
Description
The
getHealthConditions()
function is used to fetch a list of health conditions, along with their details, from EXI. These health conditions are presented to the user during the onboarding process so that they can select the conditions specific to the user, and that are necessary for obtaining a user-specific medical prescription.Parameters
On call completion: A closure or callback that takes a single parameter of type
Result<[EXIHealthCondition], EXIError>
. This completion handler will be invoked when the health conditions have been fetched successfully or an error has been encountered.Request
viewModelScope.launch { when(val result = sdk.getHealthConditions()) { is Result.Error -> { // Handle error } is Result.Success -> { // perform necessary operation. } } }
Response
Fetched health conditions successfully: Health Condition A Health Condition B Health Condition C
Errors Messages
HTTP Code Title Description 400 Bad Request Request failed to meet valdidation requirements 401 Unauthorized Error The Sdk Access Key is missing or invalid 403 Forbidden Error The API Key is not authorised to access this resource 404 Page Error Could not find the requested resource 500 Server Error An unexpected error occurred
Get health condition by ID
suspend fun getHealthConditionById(id: String): Result<EXIError, EXIHealthConditionDescription>
Description
The
getHealthConditionById
() function retrieves a health condition description based on the supplied ID. It returns aResult
object containing either anEXIError
or anEXIHealthConditionDescription
object.Parameters
id
(String): The unique identifier of the health condition for which the description is to be retrieved.Request
viewModelScope.launch { val id = "" // Health condition ID when(val result = sdk.getHealthConditionById(id = id)) { is Result.Error -> { // Handle error } is Result.Success -> { // perform necessary operation. } } }
Response
Result<EXIError, EXIHealthConditionDescription>
Errors Messages
HTTP Code Title Description 400 Bad Request Request failed to meet valdidation requirements 401 Unauthorized Error The Sdk Access Key is missing or invalid 403 Forbidden Error The API Key is not authorised to access this resource 404 Page Error Could not find the requested resource 500 Server Error An unexpected error occurred
Get Prescription
suspend fun getPrescription(week: Int? = null): Result<EXIError, EXIPrescription>
Description
The
getPrescription()
function is responsible for generating a prescription for a user based on various factors provided during the onboarding process. These factors typically include health conditions, activity level, age, and heart rate values. The function uses this information to determine the appropriate intensity level, types of workouts, and related media content for the user.Parameters
A closure or callback that takes a single parameter of type
Result<EXIPrescription, EXIError>
. This completion handler will be invoked when the prescription has been fetched successfully or encountered an error.Request
viewModelScope.launch { val week = 1 // Prescription Week when(val result = sdk.getPrescription(week = week)) { is Result.Error -> { // Handle error } is Result.Success -> { // perform necessary operation. } } }
Response
Fetched prescription successfully: Name: Prescription A Dosage: 2 tablets per day
Errors Messages
HTTP Code Title Description 400 Bad Request Request failed to meet valdidation requirements 401 Unauthorized Error The Sdk Access Key is missing or invalid 403 Forbidden Error The API Key is not authorised to access this resource 404 Page Error Could not find the requested resource 500 Server Error An unexpected error occurred
Get user Profile
suspend fun getProfile(): EXIError, EXIProfile>
Description
The
getUserProfile()
function is used to fetch the details of a user from a database. It retrieves various information related to the user’s account, health conditions, health metrics records, and custom fields records which has been submitted during onboarding.Parameters
A closure or callback that takes a single parameter of type
Result<EXIProfile?, EXIError>
. This completion handler will be invoked when the user profile has been fetched successfully or encountered an error. The profile is represented by an optionalEXIProfile
object, allowing for the possibility of anil
value if the user profile is not available or not found.Request
viewModelScope.launch { when(val result = sdk.getProfile()) { is Result.Error -> { // Handle error } is Result.Success -> { // perform necessary operation. } } }
Response
Fetched user profile successfully: Name: John Doe Age: 30 Gender: Male
Errors Messages
HTTP Code Title Description 400 Bad Request Request failed to meet valdidation requirements 401 Unauthorized Error The Sdk Access Key is missing or invalid 403 Forbidden Error The API Key is not authorised to access this resource 404 Page Error Could not find the requested resource 500 Server Error An unexpected error occurred
Update user profile
suspend fun updateProfile(updateEXIUserInfoRequestPayload: EXIUserInfoRequestPayload): Result<EXIError, EXIProfile>
Description
The
updateUserProfile()
function allows a user to edit their personal information and update it in an existing system. It provides a way for users to modify their first name and last name.Parameters
A closure or callback that takes a single parameter of type
Result<EXIProfile?, EXIError>
. This completion handler will be invoked when the update operation is completed successfully or encounters an error. The result is represented by an optionalEXIProfile
object, allowing for the possibility of anil
value if the user profile update is not successful.Request
viewModelScope.launch { val requestPayload = EXIUserInfoRequestPayload(/* Specify the required parameters */) when(val result = sdk.updateProfile(updateEXIUserInfoRequestPayload = requestPayload)) { is Result.Error -> { // Handle error } is Result.Success -> { // perform necessary operation. } } }
Response
User profile updated successfully: Name: John Doe Age: 35 Gender: Male
Errors Messages
HTTP Code Title Description 400 Bad Request Request failed to meet valdidation requirements 401 Unauthorized Error The Sdk Access Key is missing or invalid 403 Forbidden Error The API Key is not authorised to access this resource 404 Page Error Could not find the requested resource 500 Server Error An unexpected error occurred
Get Activity List
suspend fun getAllActivities(intensity: String): Result<EXIError, List<EXIActivity>>
Description
The
getActivityList()
function is used to fetch the list of activities assigned to a user based on the conditions they selected and received a prescription for. It retrieves the activities that have been assigned to the user, taking into account their specific conditions and prescription details.Parameters
intensity
: AnEXIIntensity
enum representing the desired intensity level for the activities.completion
: A closure or callback that takes a single parameter of typeResult<[EXIActivity], EXIError>
. This completion handler will be invoked when the fetching operation is completed successfully or encounters an error. The result is represented by an array ofEXIActivity
objects if the fetching is successful or anEXIError
object if an error occurs.Request
viewModelScope.launch { val intensity = "LOW" // For low intensity when(val result = sdk.getAllActivities(intensity = intensity)) { is Result.Error -> { // Handle error } is Result.Success -> { // perform necessary operation. } } }
Response
Activities fetched successfully: ID: 1 Name: Activity 1 ID: 2 Name: Activity 2 ID: 3 Name: Activity 3
Errors Messages
HTTP Code Title Description 400 Bad Request Request failed to meet valdidation requirements 401 Unauthorized Error The Sdk Access Key is missing or invalid 403 Forbidden Error The API Key is not authorised to access this resource 404 Page Error Could not find the requested resource 500 Server Error An unexpected error occurred
Submit workout/activity
suspend fun submitUserActivity(activity: EXIUserActivityData): Result<EXIError, EXIUserActivityData>
Description
The
submitUserActivity
() method finalizes and submits the recorded workout or physical activity within the application. It marks the completion of the activity session and saves the collected data for further analysis or review.Parameters
EXIUserActivityData
: The user activity to submit.Request
viewModelScope.launch { val exiActivity = EXIUserActivity(/* Specify the required parameters */) when(val result = sdk.submitUserActivity(activity = exiActivity)) { is Result.Error -> { // Handle error } is Result.Success -> { // perform necessary operation. } } }
Response
Result<EXIError, EXIUserActivityData>
Errors Messages
HTTP Code Title Description 400 Bad Request Request failed to meet valdidation requirements 401 Unauthorized Error The Sdk Access Key is missing or invalid 403 Forbidden Error The API Key is not authorised to access this resource 404 Page Error Could not find the requested resource 500 Server Error An unexpected error occurred
Get user activity data
suspend fun userActivity(loggedAt: String): Result<EXIError, List<EXIActivityData>>
Description
The
userActivity()
function is used to retrieve user activity data based on a specified time stamp. It returns aResult
objects, where theResult
can be either a success with a list ofEXIActivityData
objects representing the user activity data, or an error of typeEXIError
if there was an issue retrieving the data.Parameters
loggedAt
(String): The time stamp at which the activity data was logged. The format of the time stamp should be appropriate for the data source or storage being used.Request
viewModelScope.launch { val loggedAt = "" // Specify the logged at date when(val result = sdk.userActivity(loggedAt = loggedAt)) { is Result.Error -> { // Handle error } is Result.Success -> { // perform necessary operation. } } }
Response
Result<EXIError, EXIUserActivityData>
Errors Messages
HTTP Code Title Description 400 Bad Request Request failed to meet valdidation requirements 401 Unauthorized Error The Sdk Access Key is missing or invalid 403 Forbidden Error The API Key is not authorised to access this resource 404 Page Error Could not find the requested resource 500 Server Error An unexpected error occurred
Get activity groups
suspend fun getActivityGroups(): Result<EXIError, List<EXIActivityCategory>>
Description
The getActivityGroups() function is used to retrieve the activity groups available in the system. It returns a
Result
objects, where theResult
can be either a success with a list ofEXIActivityCategory
objects representing the activity groups, or an error of typeEXIError
if there was an issue retrieving the data.Parameters
none
Request
viewModelScope.launch { val intensity = "" // Specify the intensity when(val result = sdk.getActivityGroups(intensity = intensity)) { is Result.Error -> { // Handle error } is Result.Success -> { // perform necessary operation. } } }
Response
Result<EXIError, List<EXIActivityCategory>>
Errors Messages
HTTP Code Title Description 400 Bad Request Request failed to meet valdidation requirements 401 Unauthorized Error The Sdk Access Key is missing or invalid 403 Forbidden Error The API Key is not authorised to access this resource 404 Page Error Could not find the requested resource 500 Server Error An unexpected error occurred
Check prescription availability
suspend fun checkPrescriptionAvailability():Result<EXIError, Boolean>
Description
The
checkPrescriptionAvailability()
function is used to check the availability of a prescription. It returns aResult
objects, where theResult
can be either a success with a boolean value indicating the availability of the prescription, or an error of typeEXIError
if there was an issue checking the availability.Parameters
none
Request
viewModelScope.launch { when(val result = sdk.checkPrescriptionAvailability()) { is Result.Error -> { // Handle error } is Result.Success -> { // perform necessary operation. } } }
Response
Result<EXIError, Boolean>
Errors Messages
HTTP Code Title Description 400 Bad Request Request failed to meet valdidation requirements 401 Unauthorized Error The Sdk Access Key is missing or invalid 403 Forbidden Error The API Key is not authorised to access this resource 404 Page Error Could not find the requested resource 500 Server Error An unexpected error occurred
Update health metrics
suspend fun updateHealthMetrics(metrics: List<HealthMetric>): Result<EXIError, List<AddHealthMetricsResponse>>
Description
The
updateHealthMetrics()
function is used to update the health metrics with new data. It takes a list ofHealthMetric
objects as input, representing the metrics to be updated. It returns aResult
objects, where theResult
can be either a success with a list ofAddHealthMetricsResponse
objects indicating the successful update of each metric, or an error of typeEXIError
if there was an issue updating the metrics.Parameters
metrics
(List<HealthMetric>): The list ofHealthMetric
objects representing the metrics to be updated.Request
viewModelScope.launch { val metrics = listOf( HealthMetric(/* Specify the required parameters */) ) when(val result = sdk.updateHealthMetrics(metrics = metrics)) { is Result.Error -> { // Handle error } is Result.Success -> { // perform necessary operation. } } }
Response
Result<EXIError, List<AddHealthMetricsResponse>>
Errors Messages
HTTP Code Title Description 400 Bad Request Request failed to meet valdidation requirements 401 Unauthorized Error The Sdk Access Key is missing or invalid 403 Forbidden Error The API Key is not authorised to access this resource 404 Page Error Could not find the requested resource 500 Server Error An unexpected error occurred
Get user activity types
suspend fun getUserActivityTypes(): Result<EXIError, List<EXIUserActivityType>>
Description
The
getUserActivityTypes()
function is used to retrieve the user activity types available in the system. It returns aResult
objects, where theResult
can be either a success with a list ofEXIUserActivityType
objects representing the user activity types, or an error of typeEXIError
if there was an issue retrieving the data.Parameters
metrics
(List<HealthMetric>): The list ofHealthMetric
objects representing the metrics to be updated.Request
viewModelScope.launch { when(val result = sdk.getUserActivityTypes()) { is Result.Error -> { // Handle error } is Result.Success -> { // perform necessary operation. } } }
Response
Result<EXIError, List<EXIUserActivityType>>
Errors Messages
HTTP Code Title Description 400 Bad Request Request failed to meet valdidation requirements 401 Unauthorized Error The Sdk Access Key is missing or invalid 403 Forbidden Error The API Key is not authorised to access this resource 404 Page Error Could not find the requested resource 500 Server Error An unexpected error occurred
Log six minutes walk
suspend fun logSixMinuteWalk(payload: SixMinutesWalkPayload): Result<EXIError, EXISixMinuteWalkLog>
Description
The
logSixMinuteWalk()
function is used to log a six-minute walk activity. It takes aSixMinutesWalkPayload
object as input, which contains the necessary information to log the activity. It returns aResult
objects, where theResult
can be either a success with anEXISixMinuteWalkLog
object representing the logged activity, or an error of typeEXIError
if there was an issue logging the activity.Parameters
payload
(SixMinutesWalkPayload): The payload containing the information to log the six-minute walk activity.Request
viewModelScope.launch { val payload = SixMinutesWalkPayload(/* Specify the required parameters */) when(val result = sdk.logSixMinuteWalk(payload = payload)) { is Result.Error -> { // Handle error } is Result.Success -> { // perform necessary operation. } } }
Response
Result<EXIError, EXISixMinuteWalkLog>
Errors Messages
HTTP Code Title Description 400 Bad Request Request failed to meet valdidation requirements 401 Unauthorized Error The Sdk Access Key is missing or invalid 403 Forbidden Error The API Key is not authorised to access this resource 404 Page Error Could not find the requested resource 500 Server Error An unexpected error occurred
Get health metrics
suspend fun getHealthMetrics(metricIds: List<MetricId>? = null, startDate: String? = null): Result<EXIError, List<EXIHealthMetric>>
Description
This
getHealthMetrics()
function is used to retrieve health metrics data. It takes optional parametersmetricIds
andstartDate
to filter the metrics data. It returns aResult
objects, where theResult
can be either a success with a list ofEXIHealthMetric
objects representing the health metrics data, or an error of typeEXIError
if there was an issue retrieving the data.Parameters
metricIds
(List<MetricId>?): Optional. A list ofMetricId
objects representing the IDs of specific metrics to retrieve. Ifnull
, all available metrics will be retrieved.startDate
(String?): Optional. A string representing the start date from which to retrieve the health metrics data. Ifnull
, all available data will be retrieved.Request
viewModelScope.launch { val metricIds = listOf( MetricId.HEIGHT // Specify the list of metricId ) val startDate = "" // Specify the startDate when(val result = sdk.getHealthMetrics(metricIds = metricIds, startDate = startDate)) { is Result.Error -> { // Handle error } is Result.Success -> { // perform necessary operation. } } }
Response
Result<EXIError, List<EXIHealthMetric>>
Errors Messages
HTTP Code Title Description 400 Bad Request Request failed to meet valdidation requirements 401 Unauthorized Error The Sdk Access Key is missing or invalid 403 Forbidden Error The API Key is not authorised to access this resource 404 Page Error Could not find the requested resource 500 Server Error An unexpected error occurred
Get health metrics due
suspend fun getHealthMetricsDue(): Result<EXIError, List<MetricId>>
Description
This
getHealthMetricsDue()
function is used to retrieve the health metrics that are due for measurement. It returns aResult
objects, where theResult
can be either a success with a list ofMetricId
objects representing the health metrics due, or an error of typeEXIError
if there was an issue retrieving the due metrics.Parameters
metricIds
(List<MetricId>?): Optional. A list ofMetricId
objects representing the IDs of specific metrics to retrieve. Ifnull
, all available metrics will be retrieved.startDate
(String?): Optional. A string representing the start date from which to retrieve the health metrics data. Ifnull
, all available data will be retrieved.Request
viewModelScope.launch { when(val result = sdk.getHealthMetricsDue()) { is Result.Error -> { // Handle error } is Result.Success -> { // perform necessary operation. } } }
Response
Result<EXIError, List<MetricId>>
Errors Messages
HTTP Code Title Description 400 Bad Request Request failed to meet valdidation requirements 401 Unauthorized Error The Sdk Access Key is missing or invalid 403 Forbidden Error The API Key is not authorised to access this resource 404 Page Error Could not find the requested resource 500 Server Error An unexpected error occurred
Google Fit Integration
suspend fun startMonitoringHeartRate(activity: Activity): Flow<Int>
Description
This
startMonitoringHeartRate()
function is used to start monitoring the heart rate during a specific activity and receive real-time updates. It takes anactivity
parameter to specify the activity for which the heart rate should be monitored. The function returns aFlow
that emits the current heart rate as a double value. TheFlow
can be observed to receive updates whenever the heart rate changes.Parameters
activity
(Activity): The activity for which the heart rate should be monitored.Request
viewModelScope.launch { sdk.startMonitoringHeartRate(activity = activity).collect { rate: Int -> // ... } }
Response
Flow<Int>: A Flow that emits the current heart rate as a double value.
Errors Messages
HTTP Code Title Description 400 Bad Request Request failed to meet valdidation requirements 401 Unauthorized Error The Sdk Access Key is missing or invalid 403 Forbidden Error The API Key is not authorised to access this resource 404 Page Error Could not find the requested resource 500 Server Error An unexpected error occurred
Start monitoring steps count
suspend fun startMonitoringStepsCount(): StateFlow<Int>
Description
The
startMonitoringStepsCount()
function is used to start monitoring the steps count and receive real-time updates. It does not take any parameters. The function returns aStateFlow
that emits the current steps count as an integer value. TheStateFlow
can be observed to receive updates whenever the steps count changes.Parameters
activity
(Activity): The activity for which the heart rate should be monitored.Request
viewModelScope.launch { sdk.startMonitoringStepsCount(activity = activity).collect { rate: Int -> // ... } }
Response
StateFlow<Int>: A StateFlow that emits the current steps count as an integer value.
Errors Messages
HTTP Code Title Description 400 Bad Request Request failed to meet valdidation requirements 401 Unauthorized Error The Sdk Access Key is missing or invalid 403 Forbidden Error The API Key is not authorised to access this resource 404 Page Error Could not find the requested resource 500 Server Error An unexpected error occurred
Pause all currently running activities
suspend fun pauseAllActivities()
Description
The
pauseAllActivities()
function is used to retrieve the pause time of the current ongoing activity for a user in the EXI application. It allows users to view the duration of time they have paused or taken a break during their workout or activity.Parameters
none
Request
sdk.pauseAllActivities()
Response
Unit
Errors Messages
HTTP Code Title Description 400 Bad Request Request failed to meet valdidation requirements 401 Unauthorized Error The Sdk Access Key is missing or invalid 403 Forbidden Error The API Key is not authorised to access this resource 404 Page Error Could not find the requested resource 500 Server Error An unexpected error occurred
Sync Google Fit data
suspend fun syncGoogleFitData(from: Date, to: Date): Result<EXIError, Unit>
Description
The
syncGoogleFitData()
function synchronizes Google Fit data within the specified date range. It takes adates
parameter, which isfrom
Date andto
Date representing the dates for which the data needs to be synchronized. The function suspends execution until the synchronization is complete and returns aResult
indicating the outcome of the synchronization process.Parameters
from
The start date of the synchronization range.to
The end date of the synchronization range.Request
viewModelScope.launch { val from = Date() // Specify the from Date val to = Date() // Specify the from Date when(val result = sdk.syncGoogleFitData(from = from, to = to)) { is Result.Error -> { // Handle error } is Result.Success -> { // perform necessary operation. } } }
Response
Result<EXIError, Unit>: The result of the synchronization process. It is either: Result.Success(Unit): Indicates that the synchronization was successful. Result.Error(EXIError): Indicates an error occurred during the synchronization process, with the specific EXIError providing details about the error.
Errors Messages
HTTP Code Title Description 400 Bad Request Request failed to meet valdidation requirements 401 Unauthorized Error The Sdk Access Key is missing or invalid 403 Forbidden Error The API Key is not authorised to access this resource 404 Page Error Could not find the requested resource 500 Server Error An unexpected error occurred
Stop all activities
suspend fun stopAllActivities()
Description
This
stopAllActivities()
function is used to stop all ongoing activities or processes. It does not take any parameters. The function is responsible for terminating or halting any activities that are currently in progress.Parameters
none
Request
sdk.stopAllActivities()
Response
Unit
Errors Messages
HTTP Code Title Description 400 Bad Request Request failed to meet valdidation requirements 401 Unauthorized Error The Sdk Access Key is missing or invalid 403 Forbidden Error The API Key is not authorised to access this resource 404 Page Error Could not find the requested resource 500 Server Error An unexpected error occurred
Restart Prescription
suspend fun restartPrescription(): Flow<Result<EXIError, EXIPrescription>>
Description
The
restartPrescription()
function is used to restart a prescription for a user without asking them to edit their information. This function allows the user to continue with the same prescription, maintaining their health data records while initiating a new cycle or instance of the prescription.Parameters
A closure or callback that takes a single parameter of type
Result<EXIPrescription, EXIError>
. This completion handler will be invoked when the restart operation is completed successfully or encounters an error. The result is represented by anEXIPrescription
object if the restart is successful or anEXIError
object if an error occurs.Request
viewModelScope.launch { when(val result = sdk.restartPrescription()) { is Result.Error -> { // Handle error } is Result.Success -> { // perform necessary operation. } } }
Response
Result<EXIError, EXIPrescription>
Errors Messages
HTTP Code Title Description 400 Bad Request Request failed to meet valdidation requirements 401 Unauthorized Error The Sdk Access Key is missing or invalid 403 Forbidden Error The API Key is not authorised to access this resource 404 Page Error Could not find the requested resource 500 Server Error An unexpected error occurred
Get Analysis Report
suspend fun getAnalysisReport(): Result<EXIError, List<EXIAnalysisReport>>
Description
The
getAnalysisReport()
function is an asynchronous function that retrieves an analysis report for the data tracked by a user across all metrics and weeks of their prescription. The analysis report likely includes an overview or summary of the data tracked by the user across various health metrics, potentially including trends, patterns, or insights. The report may present the data in a graphical format to facilitate visualization and interpretation.Parameters
A closure or callback that takes a single parameter of type
Result<EXIPrescription, EXIError>
. This completion handler will be invoked when the restart operation is completed successfully or encounters an error. The result is represented by anEXIPrescription
object if the restart is successful or anEXIError
object if an error occurs.Request
viewModelScope.launch { when(val result = sdk.getAnalysisReport()) { is Result.Error -> { // Handle error } is Result.Success -> { // perform necessary operation. } } }
Response
Result<EXIError, String>
Errors Messages
HTTP Code Title Description 400 Bad Request Request failed to meet valdidation requirements 401 Unauthorized Error The Sdk Access Key is missing or invalid 403 Forbidden Error The API Key is not authorised to access this resource 404 Page Error Could not find the requested resource 500 Server Error An unexpected error occurred