Sensor.TYPE_HEART_BEAT returns null

Moderators: garrywadams, Chintannapster, Aathif Mahir, Sabertooth

Post Reply
no avatar
travis51
Posts: 1
Joined: Wed May 29, 2019 3:09 pm
Cash on hand: Locked

Sensor.TYPE_HEART_BEAT returns null

Post by travis51 » Wed May 29, 2019 3:14 pm

I'm trying to access the heart beat sensor (not heart rate) on a ticwatch c2. However, calling getDefaultSensor(Sensor.TYPE_HEART_BEAT) from the Android sensor API from my application returns null. Has anyone had experience with this issue or know how to fix it?

Code: Select all

mSensorManager = (SensorManager) getSystemService(Service.SENSOR_SERVICE);
Sensor sensor1 = mSensorManager.getDefaultSensor(Sensor.TYPE_HEART_BEAT);
mSensorManager.registerListener(HeartRateDataService.this, sensor1, SensorManager.SENSOR_DELAY_FASTEST);

if (sensor1 == null) {
           Log.d(TAG,"Sensor is null");
 }
Running the above code willreturn a null sensor1
Last edited by travis51 on Wed May 29, 2019 5:36 pm, edited 1 time in total.

User avatar
Sabertooth
Posts: 188
Joined: Tue May 15, 2018 2:18 pm
Cash on hand: Locked
Bank: Locked
Location: New York
Contact:

Re: Sensor.TYPE_HEART_BEAT returns null

Post by Sabertooth » Wed May 29, 2019 3:44 pm

Greetings travis51!

Moved your topic to Ticwatch Development. I'll see if I can get an answer about your issue.

Sabertooth
Mobvoi Global Moderator

User avatar
Sabertooth
Posts: 188
Joined: Tue May 15, 2018 2:18 pm
Cash on hand: Locked
Bank: Locked
Location: New York
Contact:

Re: Sensor.TYPE_HEART_BEAT returns null

Post by Sabertooth » Fri May 31, 2019 2:49 am

travis51 wrote:
Wed May 29, 2019 3:14 pm
I'm trying to access the heart beat sensor (not heart rate) on a ticwatch c2. However, calling getDefaultSensor(Sensor.TYPE_HEART_BEAT) from the Android sensor API from my application returns null. Has anyone had experience with this issue or know how to fix it?

Code: Select all

mSensorManager = (SensorManager) getSystemService(Service.SENSOR_SERVICE);
Sensor sensor1 = mSensorManager.getDefaultSensor(Sensor.TYPE_HEART_BEAT);
mSensorManager.registerListener(HeartRateDataService.this, sensor1, SensorManager.SENSOR_DELAY_FASTEST);

if (sensor1 == null) {
           Log.d(TAG,"Sensor is null");
 }
Running the above code willreturn a null sensor1
Greetings travis51!

The R&D Leader responds:

TicWatch C2 doesn’t have a TYPE_HEART_BEAT sensor.

All supported sensors can be listed via the following command:

Code: Select all

$ adb shell dumpsys sensorservice
End response

Hope this helps!
Sabertooth
Mobvoi Global Moderator

Post Reply