0

TypeMismatchError: Wrong Human activity recorder type passed

Here is my code :

if (tizen.systeminfo.getCapability('http://tizen.org/feature/sensor.pedometer') === false) {
    console.log('pedometer is not supported on this device.');
}
else {
    
    var query = {};
    query.startTime =(new Date(2022, 10, 5)).getTime() / 1000;
    query.endTime = (new Date(2022, 7, 31)).getTime() / 1000;
    query.anchorTime = (new Date(2022, 7, 31, 0, 0)).getTime() / 1000;
    query.interval = 1440; /* Day */
    
    console.log(JSON.stringify(query));
    
    tizen.humanactivitymonitor.readRecorderData('PEDOMETER', query, successCallback, errorCallback);
    
}

I always obtain this error message :

TypeMismatchError: Wrong Human activity recorder type passed

I declare in config.xml :

<feature name="http://tizen.org/feature/screen.size.normal"/>
<feature name="tizen.org/feature/sensor.pedometer"/>

 <tizen:privilege name="http://tizen.org/privilege/location"/>
 <tizen:privilege name="http://tizen.org/privilege/healthinfo"/>
 <tizen:privilege name="http://tizen.org/privilege/application.launch"/>
Ben
  • 11
  • 4

1 Answers1

0

endTime in the query cannot be before the startTime. When I changed just endTime in your code, it doesn't get TypeMismatchError.

You can know the types of error below link.

https://docs.tizen.org/application/web/api/6.5/device_api/wearable/tizen/humanactivitymonitor.html

WebAPIException

with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

with error type UnknownError, if registering the success callback fails because of an unknown error.

with error type NotSupportedError, if the given type is not supported on a device or by this method.

with error type SecurityError, if the application does not have the privilege to use this function.
  • I try with start and stop humanactivity and it returns a timestamp : "stepCountDifferences":[{"timestamp":1665768333,"stepCountDifference":1}], what this ? My query returns no retrieve data, why ? In fact, I search examples to retrieve health datas for syncing to phone device, steps and calories. – Ben Oct 12 '22 at 04:30
  • Do you mean that in your function "successCallback", there is no calorie item? – RexxarYrelChen Oct 12 '22 at 08:49
  • I can not retrieve datas with this example of code, have you an example ? – Ben Oct 15 '22 at 03:53
  • Did you call "startRecorder"? "readRecorderData" is getting measured data in advance. (If other apps called startRecorder, the values measured and stored.) So, If you want to get the value now, It is good to use "tizen.humanactivitymonitor.start" The example is here [link]https://docs.tizen.org/application/web/api/6.5/device_api/wearable/tizen/humanactivitymonitor.html#HumanActivityMonitorManager – RexxarYrelChen Oct 19 '22 at 07:02