Differences in behavior between Korean and European versions of the pedometer sensor?

Hello to everybody.
I’ve developed a watch face that uses the pedometer sensor.
I’ve got two watches for test, a Samsung Gear S3 and a Samsung Galaxy Watch Active 2.
The pedometer sensor indicator runs perfectly on my two watches. It always gives the same result as Samsung Health, whatever the number of steps you do in the day.
But this watch face has been rejected several times by the Samsung Test Team. They always see a difference between the number of steps displayed by my watch face on the Watch Active (1 or 2) they use for test, and the number of steps displayed by Samsung Health.
As I absolutely see no error on my watches, I don’t understand why.
Do you have an idea where it could come from? Is there a difference between Korean version and European versions of theses watches that could explain it? Do you have another idea?
You have below the code I use to manage the pedometer sensor. I reused examples I found on Tizen official websites.
Thank you very much for your help.

Main function: code to initialize the pedometer listener:
// Initialize pedometer sensor
sensor_is_supported(SENSOR_HUMAN_PEDOMETER, &pedometerSensorSupported);
if (pedometerSensorSupported) {

 	sensor_event_s event;
    	watch_time_h watch_time;
    	int day;
 	sensor_get_default_sensor(SENSOR_HUMAN_PEDOMETER, &mPedometerSensor);
	sensor_create_listener(mPedometerSensor, &MyWatchConnectionTracker::mPedometerListener);
	// Register callback
	sensor_listener_set_event_cb(MyWatchConnectionTracker::mPedometerListener, PEDOMETER_UPDATE_DELAY, PedometerSensorCallback, NULL);
	sensor_listener_set_attribute_int(MyWatchConnectionTracker::mPedometerListener,
			SENSOR_ATTRIBUTE_PAUSE_POLICY, SENSOR_PAUSE_NONE); // no pause during power-save mode

sensor_listener_set_option(MyWatchConnectionTracker::mPedometerListener,SENSOR_OPTION_ALWAYS_ON);
sensor_listener_start(MyWatchConnectionTracker::mPedometerListener);
sensor_listener_read_data (MyWatchConnectionTracker::mPedometerListener, &event);
// register the total amount of steps recorded on the watch
MyWatchConnectionTracker::mLastReferenceOfStepRecord = event.values[0];
// Get the current date, to be able to reset the pedometer indicator next day
if (watch_time_get_current_time(&watch_time) != APP_ERROR_NONE) {
// dlog_print(DLOG_ERROR, LOG_TAG, “Failed to get current time. err = %d”, ret);
}
watch_time_get_day(watch_time, &day);
MyWatchConnectionTracker::mLastDayOfStepRecord = day;
}

Main function: initialize the pedometer recorder to get the amount of steps already done in the day

// Initialize and start pedometer recorder
sensor_recorder_is_supported (SENSOR_HUMAN_PEDOMETER, &recorderSupported);
if (recorderSupported) {
	if (sensor_recorder_create_option (&option) == SENSOR_ERROR_NONE) {
		sensor_recorder_option_set_int (option, SENSOR_RECORDER_OPTION_RETENTION_PERIOD, 24);
	}
	sensor_recorder_start (SENSOR_HUMAN_PEDOMETER, option);
	if (sensor_recorder_create_query (&query) == SENSOR_ERROR_NONE) {
		// dlog_print(DLOG_WARN, "SENSOR", "Main: Recorded Steps Query Creation OK"); // Tested: OK
	}

	time_t nowTimeStamp, midnightTimestamp;
	nowTimeStamp = time(NULL); // get current date / time of the system in EPOCH format
	tm *tmNow = localtime(&nowTimeStamp);
	midnightTimestamp = nowTimeStamp - (tmNow -> tm_hour * 3600) - (tmNow -> tm_min * 60) - (tmNow -> tm_sec);
	sensor_recorder_query_set_time (query, SENSOR_RECORDER_QUERY_START_TIME, midnightTimestamp);
	// Ends now
	sensor_recorder_query_set_time(query, SENSOR_RECORDER_QUERY_END_TIME, nowTimeStamp);
	// Start the aggregation at 00H00 AM
	sensor_recorder_query_set_time(query, SENSOR_RECORDER_QUERY_ANCHOR_TIME, midnightTimestamp);
	// Aggregate every 24 hours
	sensor_recorder_query_set_int(query, SENSOR_RECORDER_QUERY_TIME_INTERVAL, 24 * 60);

	if (sensor_recorder_read_sync (SENSOR_HUMAN_PEDOMETER, query, PedometerSensorRecorderCallback, NULL) == SENSOR_ERROR_NONE) {

		// dlog_print(DLOG_WARN, "SENSOR", "Recorded Steps reading OK"); // Tested: OK
	}
}

Pedometer recorder callback:

bool PedometerSensorRecorderCallback (sensor_type_e type, sensor_recorder_data_h data, int remains, sensor_error_e error, void *user_data) {

if (type == SENSOR_HUMAN_PEDOMETER) {
	int steps;

    if (sensor_recorder_data_get_int (data, SENSOR_RECORDER_DATA_STEPS, &steps) == SENSOR_ERROR_NONE) {
	// steps = Nb steps done during the current day
    	MyWatchConnectionTracker::mStepsNumber = (float)steps;
    	MyWatchConnectionTracker::mLastReferenceOfStepRecord -= (float)steps;
    }
     else {
 		// dlog_print(DLOG_WARN, "SENSOR", "Recorded Reference of Steps NO OK = %i", steps);
     }
}
return false;

}

Pedometer sensor callback:

void PedometerSensorCallback (sensor_h sensor, sensor_event_s *event, void *user_data) {

 sensor_type_e type;

 sensor_get_type(sensor, &type);
 if (type == SENSOR_HUMAN_PEDOMETER) {
	MyWatchConnectionTracker::mStepsNumber = event->values[0] - MyWatchConnectionTracker::mLastReferenceOfStepRecord;
 }

}

OnTimeTick: code to reset the pedometer indicator every day
if (date != MyWatchConnectionTracker::mLastDayOfStepRecord) {
// we reinit the steps counter for the new day
sensor_event_s event;
MyWatchConnectionTracker::mLastDayOfStepRecord = date;
// we initialize the pedometer data
sensor_listener_read_data (MyWatchConnectionTracker::mPedometerListener, &event);
MyWatchConnectionTracker::mLastReferenceOfStepRecord = event.values[0];
MyWatchConnectionTracker::mStepsNumber = 0.0f;
}

1 Like

They should not reject you since you are not deriving the information from sHeath API in fact this is a common complaint that Tizen Studio health does not give the same results as the sHealth does.

Add a note to the reviewer and state that your step count is derived from the Tizen Studio SDK and is not sHealth derived and will not match exactly.

If they reject you again, open a 1:1 Enquiry in the Seller Portal support. If they still reject you create a support request from the dashboard and mention me in the request.

Ron
Samsung Developer Program

1 Like

Ron, thank you very much for your feedback and for your responsiveness

Hello Ron.

I followed your advice, and after 6 rejects, my watch face has been published today.
Thank you very much for your help.

1 Like

Hello pho1589136965
I tried to read number of steps already taken using your code but just after following line:
ret = sensor_listener_read_data((ad->listener), &event);
I receive error 22 in ret, which is invalid arguments.
Would you please help me share code snippet to read steps already taken by user?
This will be a great great help
Thanks