2

I am trying to set up a accelerometer service in Tizen 2.3.1 but it silently crashes before I can do anything. The "sensor_create_listener" function dies silently and never gets to my second debug statement. Any idea as to what is happening and how I can fix it?

sensor_h accelerometerSensor;
sensor_listener_h accelerometerListener;

bool service_app_create(void *data)
{
    //Set up the Accelerometer
    sensor_get_default_sensor(SENSOR_ACCELEROMETER,accelerometerSensor);
    dlog_print(DLOG_DEBUG, "USR_TAG", "Creating...");
    sensor_create_listener(accelerometerSensor, &accelerometerListener);
    dlog_print(DLOG_DEBUG, "USR_TAG", "Won't get here.");

    return true;
}
Eduard Florinescu
  • 16,747
  • 28
  • 113
  • 179
AndrewOnFire
  • 59
  • 1
  • 9
  • Did `sensor_h accelerometerSensor;` provide valid data for `sensor_create_listener()`? – Weather Vane Oct 07 '15 at 21:45
  • The code works when used it in a UI app, so I have no reason to believe that the data would be invalid now. (yes?) – AndrewOnFire Oct 07 '15 at 22:01
  • It was just an idea, since `accelerometerSensor` is supposed to be a sensor handle. As a global, is it initialised to `0`? – Weather Vane Oct 07 '15 at 22:04
  • You are right, there is some extra initialization needed that I left out from my reduced code(oops!), but even with the sensor_get_default_sensor function, the same problem happens. – AndrewOnFire Oct 07 '15 at 22:13

1 Answers1

1

Copied & Pasted your Code. I've ran the project several times in different emulators, Running well.

enter image description here

In addition:

i) May Add feature: "sensor.accelerometer" in tizen-manifest.xml to avoid being killed by the OS.

ii) include sensor.h

Md. Armaan-Ul-Islam
  • 2,154
  • 2
  • 16
  • 20