I have an Android app and I want to read the heart rate from any connected Android watch (Wear OS, Tizen, etc). Is this possible without developing a wearable app?
I tried registering a listener on the Sensor.TYPE_HEART_RATE
but I don't see any of the 3 watches that I have show up (Ticwatch E, Ticband, Gear S2). I ensured I request the Manifest.permission.BODY_SENSORS
permission.
sensorManager = getSystemService(Context.SENSOR_SERVICE) as SensorManager?
heartRateSensor = sensorManager?.getDefaultSensor(Sensor.TYPE_HEART_RATE)
val registered = sensorManager?.registerListener(this, heartRateSensor, SensorManager.SENSOR_DELAY_NORMAL)
Log.i(TAG, if (registered!!) "Registered Listener" else "Failed to register listener")
I did some research using an Android Wear watch, Samsung Gear S2, random heart rate fitness tracker watch (Ticwatch) and a standalone bluetooth heart rate arm band.
Just to reiterate my goal was to read heart rate data from the watch's sensor through my phone app without making a watch app.
My findings were as follows:
I hope this clarifies how the SensorManager only works for sensors on the device the app is running on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With