Reputation: 1
I have used below method to get data from google fit app:
fun aggregateGroupByDuration(record: ReadableMap, promise: Promise) {
throwUnlessClientIsAvailable(promise) {
coroutineScope.launch {
try {
val recordType = record.getString("recordType") ?: ""
val response = healthConnectClient.aggregateGroupByDuration(
ReactHealthRecord.getAggregateGroupByDurationRequest(
recordType, record
)
)
promise.resolve(ReactHealthRecord.parseAggregationResultGroupedByDuration(recordType, response))
} catch (e: Exception) {
promise.rejectWithException(e)
}
}
}
}
& using below code to fetch steps : override fun parseAggregationResultGroupedByDuration(record:
List<AggregationResultGroupedByDuration>): WritableNativeArray {
return WritableNativeArray().apply {
record.forEach {
val map = WritableNativeMap().apply {
putMap("result", parseAggregationResult(it.result))
putString("startDate", it.startTime.toString())
putString("endDate", it.endTime.toString())
putString("zoneOffset", it.zoneOffset.toString())
putDouble("quantity", it.result[StepsRecord.COUNT_TOTAL]?.toDouble() ?: 0.0)
}
pushMap(map)
}
}
}
I have used implementation "androidx.health.connect:connect-client:1.1.0-alpha07" dependency. This issue is only occurring in Android 14. In below versions I am getting proper data from google fit app in my application.
I want to get health data from google fit in my android 14 device, like how much steps user have done in google fit application on particular data.
Upvotes: 0
Views: 10