Skip to content

Add get and write HealthData by UUID method #1165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from

Conversation

agilst
Copy link

@agilst agilst commented Mar 18, 2025

  • Update README file
  • Update example app to show health point detail on the bottom sheet dialog
  • Adjust fetch data loading indicator sizing

Note: both Swift and Kotlin codes to getDataByUUID is copied from getData and modified to return an single record instead of list.

- Update README file
- Update example app to show health point detail on the bottom sheet dialog
- Adjust fetch data loading indicator sizing
@agilst
Copy link
Author

agilst commented Mar 19, 2025

Based on this issue #1139, I have updated writeHealthData and writeWorkoutData to return HealthDataPoint instead, but keep the writeBloodOxygen and writeMenstruationFlow to return bool.

Kindly review and make additional changes if required. Please let me know if we need/have different approaches to achieve this goal.

@iarata iarata self-assigned this Mar 19, 2025
@iarata iarata self-requested a review March 19, 2025 13:37
@iarata iarata changed the title Add getHealthDataByUUID method Add get and write HealthData by UUID method Mar 19, 2025
@iarata iarata changed the title Add get and write HealthData by UUID method Add get and write HealthData by UUID method Mar 19, 2025
@iarata
Copy link
Contributor

iarata commented Mar 19, 2025

Thanks for the PR! I was actually trying to make this after I saw #1139.
Wouldn't it make sense for the get method to not have start and end time? If one already knows the exact UUID of a record then I think it wouldn't make sense to filter to a specific range

@agilst
Copy link
Author

agilst commented Mar 19, 2025

The start and end time is for Android only as they do not expose any API to get a single record by uuid, so I'm using tiniest time range to get small amount of records then find it by uuid. however, start and end time will not be used for iOS as it only needs to pass uuid and type to get a single record.

@iarata
Copy link
Contributor

iarata commented Mar 19, 2025

In health connect there is two ways to read readRecord and readRecords.
Only the readRecords need a ReadRecordsRequest which requires a time range, otherwise the readRecord just needs the id and type:

suspend fun <T : Record> readRecord(recordType: KClass<T>, recordId: String): ReadRecordResponse<T>

@agilst
Copy link
Author

agilst commented Mar 19, 2025

oh my bad I wasn't aware of it. I can switch to that method instead

Agil Setiawan added 3 commits March 20, 2025 08:57
- Remove start and end time on native methods
- Android: change readRecords() to readRecord()
- Update inline documentation on health_plugin
- Update README
- Example: remove startTime from fetchDataByUUID method
- Add an ability to openDetailBottomSheet onLongPress with existing HealthDataPoint for preview purpose
@iarata
Copy link
Contributor

iarata commented Apr 30, 2025

@agilst could you separate the implementation for android to a new PR? i have stopped adding new features to the swift due to #1175

@agilst
Copy link
Author

agilst commented May 2, 2025

@iarata I'm afraid I couldn't make any changes on this branch (on forked repo) as I'm using it for production. I will instead create a new branch for iOS and Android for this implementation and sync with master changes for me to work safely, then I will submit a PR for iOS first followed by Android afterwards.

Edit: I will also separate the write implementation so things don't get mixed up.

@agilst
Copy link
Author

agilst commented May 2, 2025

@agilst could you separate the implementation for android to a new PR? i have stopped adding new features to the swift due to #1175

iOS part is done here #1193. please review

@agilst
Copy link
Author

agilst commented May 2, 2025

@iarata Separated Android implementation PR is here #1194

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants