简体   繁体   English

Tizen Web App:readRecorderData TypeError:'undefined'不是一个函数

[英]Tizen Web App: readRecorderData TypeError: 'undefined' is not a function

I'm developing a Tizen web application for Gear Fit2 and i got an 'Type Error: undefined is not a function (tizen.humanactivitymonitor.readRecorderData(type, query, onread, onerror)' error when i called a "readRecorderData" function of a Human Activity API. However when i call a "start" function of the same API it works perfectly. 我正在为Gear Fit2开发Tizen Web应用程序,但出现“类型错误:未定义不是函数(tizen.humanactivitymonitor.readRecorderData(类型,查询,onread,onerror)”错误),当我调用了“ readRecorderData”函数时一个人类活动API,但是当我调用相同API的“开始”功能时,它可以完美运行。

I put healthinfo and location privilege to my config.xml: 我将healthinfo和位置特权添加到config.xml中:

<tizen:privilege name="http://tizen.org/privilege/healthinfo"/>
<tizen:privilege name="http://tizen.org/privilege/location"/>

Hope you guys can help. 希望你们能提供帮助。 Thanks. 谢谢。

There is a sample of my code that i used: 我使用了我的代码示例:

var type = 'PEDOMETER';
var now = new Date();
var startTime = now.setDate(now.getDate() - 7);
var anchorTime = (new Date(2018, 1, 2, 6)).getTime();
var query = {
  startTime: startTime / 1000,
  anchorTime: anchorTime / 1000,
  interval: 1440 /* 1 day */
};

try { tizen.humanactivitymonitor.readRecorderData(type, query, onread, onerror); } 
catch (err) { console.log(err.name + ': ' + err.message); }

The reason is your device runs on 2.3.1 or below Tizen OS version. 原因是您的设备运行在2.3.1或更低的Tizen OS版本上。

Check the API References Doc for readRecorderData(): Since 2.3.2 检查API参考文档中的readRecorderData():从2.3.2开始

If you create a project with 2.3.2 (or above) tizen version and deploy on Tizen device or Emulator running on tizen 2.3.2 (or above) this error will be gone. 如果您创建具有2.3.2(或更高版本)tizen版本的项目并部署在运行于tizen 2.3.2(或更高版本)上的Tizen设备或仿真器上,此错误将消失。

But for your case, HRM Recorder is supported from tizen 2.3.2 so you can't use it. 但是对于您的情况,tizen 2.3.2支持HRM Recorder,因此您无法使用它。 Try a different workaround like storing sensor data in local storage or file system manually. 尝试其他解决方法,例如将传感器数据手动存储在本地存储或文件系统中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM