mirror of
https://github.com/MrUnknownDE/wearos-heartmonitor-wss.git
synced 2026-04-06 00:31:59 +02:00
some healt-services fixes
This commit is contained in:
@@ -3,6 +3,7 @@ import com.android.build.api.dsl.ApplicationDefaultConfig
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
kotlin("android")
|
||||
id("org.jetbrains.kotlin.plugin.serialization")
|
||||
}
|
||||
|
||||
android {
|
||||
@@ -55,8 +56,11 @@ dependencies {
|
||||
// Wear OS UI helpers (optional, for round screens)
|
||||
implementation("androidx.wear:wear:1.3.0")
|
||||
|
||||
// Health Services client (Wear OS)
|
||||
implementation("androidx.health:health-services-client:1.1.0")
|
||||
// Health Services client (Wear OS) - Version corrected
|
||||
implementation("androidx.health:health-services-client:1.1.0-alpha01")
|
||||
|
||||
// For .await() on ListenableFuture
|
||||
implementation("androidx.concurrent:concurrent-futures-ktx:1.1.0")
|
||||
|
||||
// OkHttp WebSocket
|
||||
implementation("com.squareup.okhttp3:okhttp:4.12.0")
|
||||
|
||||
@@ -2,16 +2,13 @@ package com.mrunk.wearhr
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import androidx.concurrent.futures.await
|
||||
import androidx.health.services.client.ExerciseClient
|
||||
import androidx.health.services.client.HealthServices
|
||||
import androidx.health.services.client.data.DataType
|
||||
import androidx.health.services.client.data.ExerciseCapabilities
|
||||
import androidx.health.services.client.data.ExerciseConfig
|
||||
import androidx.health.services.client.data.ExerciseGoal
|
||||
import androidx.health.services.client.data.ExerciseType
|
||||
import androidx.health.services.client.data.HeartRateAccuracy
|
||||
import androidx.health.services.client.data.IntervalGoal
|
||||
import androidx.health.services.client.data.SetGoal
|
||||
import androidx.health.services.client.event.ExerciseUpdate
|
||||
import androidx.health.services.client.event.ExerciseUpdateListener
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
|
||||
@@ -4,9 +4,6 @@ import android.Manifest
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Bundle
|
||||
import android.widget.Button
|
||||
import android.widget.EditText
|
||||
import android.widget.TextView
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
@@ -19,7 +16,7 @@ class MainActivity : AppCompatActivity() {
|
||||
ActivityResultContracts.RequestPermission()
|
||||
) { granted ->
|
||||
if (!granted) {
|
||||
findViewById<TextView>(R.id.statusText).text = "Permission denied"
|
||||
binding.statusText.text = "Permission denied"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +49,6 @@ class MainActivity : AppCompatActivity() {
|
||||
return
|
||||
}
|
||||
startForegroundService(Intent(this, HrStreamService::class.java))
|
||||
findViewById<TextView>(R.id.statusText).text = "Starting…"
|
||||
binding.statusText.text = "Starting…"
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
plugins {
|
||||
id("com.android.application") version "8.12.0" apply false
|
||||
id("org.jetbrains.kotlin.android") version "2.1.20" apply false
|
||||
}
|
||||
id("com.android.application") version "8.4.1" apply false
|
||||
id("org.jetbrains.kotlin.android") version "1.9.23" apply false
|
||||
id("org.jetbrains.kotlin.plugin.serialization") version "1.9.23" apply false
|
||||
}
|
||||
Reference in New Issue
Block a user