我正在使用 Tizen SDK 2.2 并尝试使用以下代码在我的 Web 应用程序中设置 AlarmRelative:
var alarm = new window.tizen.AlarmRelative(window.tizen.alarm.PERIOD_MINUTE);
window.tizen.alarm.add(alarm, window.tizen.application.getCurrentApplication().appInfo.id);
在我的 config.xml 中,我添加了以下权限和功能:
<tizen:privilege name="http://tizen.org/privilege/alarm"/>
<tizen:privilege name="http://tizen.org/privilege/tizen"/>
<feature name="http://tizen.org/api/tizen" required="true"/>
<feature name="http://tizen.org/api/alarm" required="true"/>
<feature name="http://tizen.org/api/alarm.read" required="true"/>
<feature name="http://tizen.org/api/alarm.write" required="true"/>
一旦我尝试用 window.tizen 做某事,模拟器就会给我以下异常:
Exception: TypeError: 'undefined' is not an object
当我在模拟器上运行完全相同的程序时,它确实有效,并且实际上设置了警报。我已经确保一切都在运行 2.2。还尝试了一个 AlarmAbsolute 和一些简单的东西,比如记录时间格式:
console.log("Time format: " + window.tizen.time.getTimeFormat());
但两者都给了我相同的结果。我一直在寻找一段时间,但找不到任何有解决方案的人,所以我想我会在这里尝试。我的模拟器刚刚坏了,是我忘了做某事,还是其他原因?