Heart Rate and Pedometer Sen

I am trying to develop a watch face that uses heart rate and pedometer information, I have searched all over here and can't figure out how to fix my problem.

I have included <sensor.h> and set privalege

The problem i am having is when I run  

sensor_get_default_sensor(SENSOR_HRM, &sensorHanlder);

for either the pedometer or the heart rate monitor, it returns -13 (Permission Denied) and I cant figure out anything regarding how to fix that. I also tride using 

sensor_get_default_sensor_by_uri("", &sensorHandler);

and it gives me the same error.

I have gotten this same code working for the accelerometer, so It is structured right for at least some sensors.

I am running tizen 4.0 with the emulator and on my galaxy watch and get the same results. any help would be greatly appreciated

the following is the section of code I am using (from example code from this site):

float hrnow;
int success;

bool checkSupport(sensor_type_e type){
      bool support;
      return support;

//for heart rate monitor
void sensorEventCallBack(sensor_h sensorHanlder, sensor_event_s *event, void *user_data){
     sensor_type_e type;
     sensor_get_type(sensorHanlder, &type);
     switch (type)
     case SENSOR_HRM:
      dlog_print(DLOG_DEBUG, LOG_TAG, "SENSOR_HRM data: %.2f", event->values[0]);
      hr_now = event->values[0];
      dlog_print(DLOG_ERROR, LOG_TAG, "Not an HRM event");

void logPrintSensorData(appdata_s *ad){


          sensor_h sensorHandler;
          success = sensor_get_default_sensor(SENSOR_HRM, &sensorHanlder);
//          success = sensor_get_default_sensor_by_uri("", &sensorHandler);
          sensor_listener_h sensorListener;
          sensor_listener_set_event_cb(sensorListener,1000, sensorEventCallBack, NULL);

           /* Once Task Completed*/

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


3 Replies
Jacob Olson


I compiled this with the tizen 3.0 api rather than the 4.0 api and it worked. anyone know why tizen 4.0 would not give access to heartrate and pedometer sensors? or is there a new way that you are supposed to do it?

Luzian Scherrer

Have you been able to solve this with the Tizen 4.0 API? I'm facing the exact same problem.

Luzian Scherrer

I've figured it out by now. On Tizen 4 the user has to go to Settings - Apps - Permissions and manually toggle sensor permission for your app to "on". You can however check in code with the ppm_check_permission() function for permission and if it returns PRIVACY_PRIVILEGE_MANAGER_CHECK_RESULT_ASK you can trigger a permission request dialog with the ppm_request_permission() function. This is documented here:

That's fine in a consumer context I think but since I'm running in a controlled enterprise environment, I need to find a way to grant this permission for the managed devices. I quickly checked the Knox SDK but didn't find anything about sensor permission.