Native Device Data Settings

These methods allow you to interact with native device data collection screens/settings on mobile devices. They are only available from the indicated MyDataHelps mobile apps.

Health Connect

Health Connect provides access to health and fitness data on Android devices using the MyDataHelps Android app. There are two broad types of data available through Health Connect:

  • Health/Fitness Data, such as activity and vitals.
  • Personal Health Record (PHR), aka medical records, from FHIR-based electronic medical record systems.

Before MyDataHelps can access any Health Connect data, the app must prompt the participant for permissions. Health Connect has a fine-grained permission system, so the participant can choose to allow/deny access to specific record types.

The suggested workflow is:

  1. Check that the participant is on an Android device using getDeviceInfo().
  2. Check that Health Connect is supported using (using getHealthConnectStatus and/or getHealthConnectPhrStatus).
  3. Prompt the participant to enable the necessary data collection (using showHealthConnectPrompt and/or showHealthConnectPhrPrompt).
  4. Check which data collection is enabled (using getHealthConnectStatus or getHealthConnectPhrStatus) to drive survey/notification logic.
  5. Consider adding a button/link so the participant can easily modify their Health Connect settings (using showHealthConnectSettings).

The following Health Connect resources may be useful for understanding the different kinds of data available via Health Connect.


Show Health Connect Prompt (Native Android Only)

MyDataHelps.showHealthConnectPrompt()

Prompts the participant to allow data collection for any Health Connect query rules requested by the project but not already enabled. If all requested query rules are already enabled, this method will do nothing.

If the participant has denied the request twice, the MyDataHelps app is not permitted to prompt them again. In that case, calling this method will show the Health Connect configuration screen, equivalent to calling showHealthConnectSettings().

Personal Health Record data requires a separate prompt, via showHealthConnectPhrPrompt.

Availability

MyDataHelps Views
MyDataHelps Embeddables
Web View Steps


Show Health Connect PHR Prompt (Native Android Only)

MyDataHelps.showHealthConnectPhrPrompt()

Prompts the participant to enable data collection for data associated with the participant’s Personal Health Record (PHR). It will ask for any Health Connect PHR permissions requested by MyDataHelps but not already enabled. If all requested permissions are already enabled, this method will do nothing.

If the participant has denied the request twice, the MyDataHelps app is not permitted to prompt them again. In that case, calling this method will show the Health Connect configuration screen, equivalent to calling showHealthConnectSettings().

Health/Fitness data requires a separate prompt, via showHealthConnectPrompt.

Availability

MyDataHelps Views
MyDataHelps Embeddables
Web View Steps


Show Health Connect Settings (Native Android Only)

MyDataHelps.showHealthConnectSettings()

Opens the Health Connect configuration screen.

Availability

MyDataHelps Views
MyDataHelps Embeddables
Web View Steps


Get Health Connect Status (Native Android Only)

MyDataHelps.getHealthConnectStatus()

Returns information about the current Health Connect status, including which query rules are requested and enabled.

Personal Health Record (PHR) data status requires a separate query, via getHealthConnectPhrStatus.

Returns

Promise<HealthConnectStatus>

Resolves to a result object containing status information.

result.available bool

Indicates whether Health Connect is available on the device.

result.requestedQueryRules string array

Lists query rules the project is requesting for the participant.

result.enabledQueryRules string array

Lists query rules the participant has enabled from among the requestedQueryRules.

result.running bool

Indicates whether Health Connect is currently syncing data.

result.lastPrompted date

Last time the prompt (or settings screen, if prompting was not allowed) was shown to the participant for this project, in ISO8601 format.

Availability

MyDataHelps Views
MyDataHelps Embeddables
Web View Steps


Get Health Connect PHR Status (Native Android Only)

MyDataHelps.getHealthConnectPhrStatus()

Returns information about the current status of data collection for Personal Health Record (PHR) data, including which permissions are requested and enabled.

Health/Fitness data status requires a separate query, via getHealthConnectStatus.

Returns

Promise<HealthConnectPhrStatus>

Resolves to a result object containing status information.

result.available bool

Indicates whether Health Connect PHR is available on the device.

result.requestedPermissions string array

Lists permissions the project is requesting for the participant.

result.enabledPermissions string array

Lists permissions the participant has enabled from among the requestedPermissions.

result.running bool

Indicates whether Health Connect PHR is currently syncing data.

result.lastPrompted date

Last time the prompt (or settings screen, if prompting was not allowed) was shown to the participant for this project, in ISO8601 format.

Availability

MyDataHelps Views
MyDataHelps Embeddables
Web View Steps


Google Fit

Google Fit is being retired by Google, and these methods are only available for backwards-compatibility. Projects should use Health Connect instead.

Show Google Fit Settings (Native Android Only)

MyDataHelps.showGoogleFitSettings()

Opens the Google Fit configuration screen. This will only work when accessing MyDataHelps via the native Android app, so you should check the Current Device Information before attempting it.

Availability

MyDataHelps Views
MyDataHelps Embeddables
Web View Steps