add possibility to write records#6
Conversation
src/Maui.Health/Platforms/iOS/Extensions/HKQuantitySampleExtensions.cs
Outdated
Show resolved
Hide resolved
src/Maui.Health/Platforms/iOS/Extensions/HKQuantitySampleExtensions.cs
Outdated
Show resolved
Hide resolved
src/Maui.Health/Platforms/iOS/Extensions/HKWorkoutActivityTypeExtensions.cs
Outdated
Show resolved
Hide resolved
|
Android reflections reasons:
The NuGet package Xamarin.AndroidX.Health.Connect.ConnectClient is version 1.1.0-alpha07 - a prerelease. The bindings are auto-generated
Health Connect SDK uses Kotlin's Companion object for factory methods: In C#, this becomes inaccessible because:
When reading values like weight or calories, the SDK returns Mass or Energy objects. To extract the actual double value:
The extraction methods (ExtractMassValue, ExtractEnergyValue, etc.) must use reflection fallbacks:
Kotlin properties compile to Java getter methods with specific naming:
TryGetUnitConstant() in JavaReflectionHelper.cs:180-217 accesses static fields like Mass.KILOGRAMS which are unit constants needed for When Can Reflection Be Removed? Reflection can potentially be removed when:
Summary
The reflection is a necessary workaround for Xamarin binding limitations, not a design choice. The battle-tested multiple-fallback |
|
I just wanted to add a note in case you all weren't aware. Not sure if this at all affects your planned changes. I haven't reviewed all the work that you all have done. |
|
@jmichas thanks for the heads-up |
No description provided.