0

I'm trying to creare a watch face that show the cumulative number of calories burned from the midnight. I can't find a simple solution for doing this. There are several watch face (Eg IWD_LCD) that already do this but I don't know how. Maybe this read data from samsung healt (in this case, how to do this)?

Thanks

user3691431
  • 775
  • 6
  • 7

2 Answers2

0

There's a Watch Face Designer tool called 'Gear Watch Designer'. But as far as I know, you won't be able to retrieve cumulative calories burned from such designer tool. You have to develop a Tizen Native(C/C++) or Web(HTML/CSS/js) watchface using Tizen-Studio.

Native Efl Watch Application Guide

Native DALi Watch Application Guide

Web Watch Application Guide

By Using Tizen native Sensor API you can retrieve Pedometer data, such as: steps, calories burned,etc. I don't see cumulative calories burned data on the API references, but you can add the 'calories burned' and produce cumulative data. Once you have retrieved the 'calories burned' data then you need UI components to show the Info on your watchface.

I'm sharing a C code sample with you to retrieve calories burned data:

#include <sensor.h>
#include<stdbool.h>

bool checkSupport(sensor_type_e type){
     bool support;
     sensor_is_supported(type,&support);
     return support;
}

void sensorEventCallBack(sensor_h sensorHanlder, sensor_event_s *event, void *user_data){

      dlog_print(DLOG_DEBUG, LOG_TAG, "Number of steps: %d", event->values[0]);
      dlog_print(DLOG_DEBUG, LOG_TAG, "Number of walking steps: %d", event->values[1]);
      dlog_print(DLOG_DEBUG, LOG_TAG, "Calories burned: %.2f kcal", event->values[4]);
       /* values[0] to values[7]*/
}

void logPrintSensorData(){

     if(checkSupport(SENSOR_HUMAN_PEDOMETER)){

         sensor_h sensorHanlder;
         sensor_get_default_sensor(SENSOR_HUMAN_PEDOMETER, &sensorHanlder);

         sensor_listener_h sensorListener;
         sensor_create_listener(sensorHanlder,&sensorListener);

         sensor_listener_set_event_cb(sensorListener,1000, sensorEventCallBack, NULL);
         sensor_listener_set_option(sensorListener,SENSOR_OPTION_ALWAYS_ON);
         sensor_listener_start(sensorListener);

          /* Once Task Completed*/
         //sensor_listener_stop(sensorListener);

     }

     else {
         dlog_print(DLOG_ERROR, LOG_TAG, "SENSOR_HUMAN_PEDOMETER Not Supported");
     }
}

In tizen-manifest.xml add privilege http://tizen.org/privilege/healthinfo

You can also try Tizen Web API instead of Tizen Native API If you like to do so. For details:

Tizen Native Sensor Guide

Tizen Web Sensor Guide

Md. Armaan-Ul-Islam
  • 2,154
  • 2
  • 16
  • 20
  • Hi, thanks but this isn't a solution. You are talking abound reading pedometer data that it's completely different from samsung healt cumulative calories value. For example Samsung healt calculates calories burned from the body also when you are sleeping (based on heartrate) so at the end of the day you can know exactly the amount of calories burned. In the way you suggest you will count only calories related to walk or running. – user3691431 Jan 19 '18 at 16:44
  • Agree. This is the way to read raw data from pedometer sensor, Please check my other answer for clarification. – Md. Armaan-Ul-Islam Jan 22 '18 at 03:45
0

'Samsung health' application reads raw data from various sensors and Process Info based on their method/algorithm.

But a 3rd party developer won't have access to Samsung health's application data. There's a SDK available to do that, but thats for only Samsung Partners.

Samsung Health SDK

So, You have to calculate 'calories burned' your own, using maths & data from various sensor. (Like 'X' hours of sleep burns 'Y' calories )

Md. Armaan-Ul-Islam
  • 2,154
  • 2
  • 16
  • 20
  • I don't understand how so many thirdy party watch faces can access Samsung healt data. You can find ton of watch faces that show Samsung Healt data (An example is "IWD_LCD"). Samsung healt sdk provide rest api for accessing data, maybe this is the solution but this require user to make access to your samsung account and no one watch face has ever requested to my something like that. I think should be something obvious that many developer use but that no one share. I really don't think that so many developer implements an algoritm for calculating itself calories burned during all the day. – user3691431 Jan 23 '18 at 08:17