- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我尝试从 Pebble 向 JS 应用程序发送一条简单的消息,但它总是失败,并显示错误代码 APP_MSG_SEND_TIMEOUT。然而,从 JS 向设备发送消息就像一个魅力。这是我的代码:
app_message_register_inbox_received(in_received_handler);
app_message_register_inbox_dropped(in_dropped_handler);
app_message_register_outbox_sent(out_sent_handler);
app_message_register_outbox_failed(out_failed_handler);
const uint32_t inbound_size = 512;
const uint32_t outbound_size = 512;
app_message_open(inbound_size, outbound_size);
// some UI things...
DictionaryIterator *iter;
app_message_outbox_begin(&iter);
if(iter == NULL)
APP_LOG(APP_LOG_LEVEL_DEBUG, "null iter");
Tuplet value = TupletInteger(0, 42);
dict_write_tuplet(iter, &value);
dict_write_end(iter);
app_message_outbox_send();
我的所有处理程序仅包含几行日志记录代码。我的 JS 是:
Pebble.addEventListener("ready",
function(e) {
console.log("JavaScript app ready and running!");
Pebble.sendAppMessage({"0": 42, "1": "hello"}, function(e) {
console.log("success");
}, function(e) {
console.log("fail");
});
}
);
Pebble.addEventListener("appmessage", function(e) {
console.log("received message: " + e.payload);
});
最后,我的日志输出是这样的:
[PHONE] pebble-app.js:?: {'runhost client uuid' = 00000000-0000-0000-0000-000000000000}:{'webapp uuid' = 00e9f277-489d-4c97-87ba-22659062bf12}: ++_JS_LIFECYCLE_++:LAUNCHING
[PHONE] pebble-app.js:?: {'runhost client uuid' = 00000000-0000-0000-0000-000000000000}:{'webapp uuid' = 00e9f277-489d-4c97-87ba-22659062bf12}: ++_JS_LIFECYCLE_++:LAUNCHING
[PHONE] pebble-app.js:?: CTwitch__1/pebble-js-app.js:3 JavaScript app ready and running!
[PHONE] pebble-app.js:?: {'runhost client uuid' = 833ceb3c-9bf6-40e5-a14d-48c401515ca2}:{'webapp uuid' = 00e9f277-489d-4c97-87ba-22659062bf12}: ++_JS_LIFECYCLE_++:READY-RUNNING
[DEBUG] hello_world.c:15: Got message!
[PHONE] pebble-app.js:?: CTwitch__1/pebble-js-app.js:5 success
[ERROR] hello_world.c:71: Outbox failed!
[ERROR] hello_world.c:72: APP_MSG_SEND_TIMEOUT
我可能错过了一些简单的东西,但我一生都无法弄清楚。
最佳答案
我猜您自己已经找到了答案,但省略了将其发布在这里。
这是 watch 和手机之间的计时问题。
如果您在应用程序中将发送延迟到稍后,一旦所有内容都加载并“安定下来”,它就会按照书中的方式工作。
请参阅我在 pebble SDK 上的帖子论坛
关于javascript - AppMessage 总是失败并显示 APP_MSG_SEND_TIMEOUT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22975216/
我希望更清楚地了解影响传入 watch 的应用消息的最大允许大小的因素。 SDK 保证有效的最大大小为 124 字节,the docs说“在某些情况下,Pebble 可能能够为您的应用程序提供更大的收
标题总结了它。同样的问题是here .在 SO 上发帖看看我是否能得到任何帮助。我还做了一个 almost minimal project为了演示我面临的问题,因此后面的链接指向所提到的代码段。 没什
我尝试从 Pebble 向 JS 应用程序发送一条简单的消息,但它总是失败,并显示错误代码 APP_MSG_SEND_TIMEOUT。然而,从 JS 向设备发送消息就像一个魅力。这是我的代码: app
我正在尝试在 Pebble 上显示 128px * 128px 的图像,该图像是通过 AppMessage 从 Android 发送的。 在 Android 应用程序中,我有一个 BitmapFact
我正在尝试使用 Pebble SDK,并且想从网络读取太阳能数据。我已经成功地完全用 JS 构建了一个应用程序。看这个link 。 由于我发现 JS 存在一些限制,因此我正在用 C 重写代码。当通过J
在 Watch 上我发送这样的 AppMessage DictionaryIterator *iter; app_message_outbox_begin(&iter); Tuplet value =
我是一名优秀的程序员,十分优秀!