Nader Ki
Nader Ki

Reputation: 1

Moto 360 unable to access heartbeat sensor

I was having some trouble accessing the heartbeat sensor on the Moto 360 in an Android wear project. Using the code:

    for (Sensor sensor : mSensorManager.getSensorList(Sensor.TYPE_ALL)) {
        Log.e("HB Service", sensor.getName() + ": " + sensor.getType());
    }

I found out that the heartbeat sensor and wellness sensors both don't show up in this list. I've tried using Sensor.TYPE_HEART_RATE as well, but either way, registering the listener says that the sensor is null. Anyone have advice to get this working?

Upvotes: 0

Views: 98

Answers (1)

abielita
abielita

Reputation: 13469

Make sure that you put the permission below for the body data in your Manifest.xml:

uses-permission android:name="android.permission.BODY_SENSORS"

Another workaround in this thread is:

Sensor.TYPE_HEART_RATE is actually the correct ID. I had the same issue: the sensor was null even though I had the BODY_SENSORS permission in the manifest. I fixed it by removing the app, restarting the watch and by requesting the BODY_SENSORS permission at runtime (see https://developer.android.com/training/articles/wear-permissions.html). After that I got the system dialogue for the body sensor permission and I then started receiving updates from the sensor.

Also make sure that you have the latest SDK. Hope this helps!

Upvotes: 0

Related Questions