android / android/health-samples

Passive Goals - Not getting Steps, Calories etc. Getting only Heart_rate

Open
#75 15 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
346
Forks
183
PR merge metrics
No merged PRs in 30d

Description

Passive Goals - Not getting Steps, Calories etc. Getting only Heart_rate

Environment: Mac OSx - Android Studio IDE, Wear OS Emulator

Set daily calories - here private val dataTypes = setOf(DataType.HEART_RATE_BPM, DataType.DAILY_CALORIES)

class HealthServicesRepository(context: Context) {

private val healthServicesClient = HealthServices.getClient(context)

private val passiveMonitoringClient = healthServicesClient.passiveMonitoringClient

private val dataTypes = setOf(DataType.HEART_RATE_BPM, DataType.DAILY_CALORIES)

private val passiveListenerConfig = PassiveListenerConfig(

dataTypes = dataTypes,

shouldUserActivityInfoBeRequested = false,

dailyGoals = setOf(),

healthEventTypes = setOf()

)

......
......

But after that not get any data points on the onNewDataPointsReceived method.

class PassiveDataService : PassiveListenerService() {

private val repository = PassiveDataRepository(this)

override fun onNewDataPointsReceived(dataPoints: DataPointContainer) {

runBlocking {

dataPoints.getData(DataType.HEART_RATE_BPM).latestHeartRate()?.let {

repository.storeLatestHeartRate(it)

}

}

}

}

Please help me to get heart rate, daily steps, daily calories, distance etc from PassiveData sample app with correct permissions, settings and flows required

Thanks in Advance

Contributor guide

Open the contributing guide

Research direction

Start with the PassiveData sample app, especially HealthServicesRepository and PassiveDataService, and trace the passive listener configuration into onNewDataPointsReceived. Reproduce the Wear OS emulator setup described in the issue, then inspect the permissions, settings, and flows needed for heart rate, daily steps, calories, and distance; done means those data points are delivered and handled by the sample.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.