gpt4 book ai didi

asynchronous - 在蓝牙连接事件中发送消息时不接收 AppMessage 回调

转载 作者:行者123 更新时间:2023-12-04 02:42:05 25 4
gpt4 key购买 nike

标题总结了它。同样的问题是here .在 SO 上发帖看看我是否能得到任何帮助。我还做了一个 almost minimal project为了演示我面临的问题,因此后面的链接指向所提到的代码段。

没什么特别的 我目前在做什么:

  • 我的表盘是 notified与手机的蓝牙连接已建立,使用 .pebble_app_connection_handler .
  • 在那bluetooth callback我设置,我send message to the phone使用 app_message_outbox_send() .当然,当 BT 连接启动时。
  • 我的 Android 应用有一个 BroadcastReceiver收听这些消息和 calls an IntentService .
  • IntentService calculates the data , pushes it to the watchsets itself to run again一段时间后。

  • 我的期望 :
  • 当 BT 连接建立时,将调用连接处理程序。
  • app_message_outbox_send()返回一个值,告诉消息启动是否有任何错误。通常,这是 APP_MSG_OK ,但它可以是 APP_MSG_BUSY ,我非常清楚这一点。
  • 调用应用消息回调(app_message_register_inbox_received 和 friend )以指示向手机发送消息的异步过程是否真的有效。这在 docs 中有说明.

  • 我所看到的 :

    加载表盘时会发生预期的步骤,因为我手动触发更新。但是,当更新由 BT 连接事件触发时,会发生预期的步骤 1 和 2,但不会发生步骤 3。

    当我收到 APP_MSG_OK 时,这尤其令人恼火。在第 2 步中,因为我应该合理地期望 watch 上的一切正常,并且我应该准备好自己在应用程序消息回调中接收一些东西。基本上,文档告诉我要等待一个永远不会到来的电话。

    这种情况 100% 发生 .

    感谢您的任何帮助。我有另一种可行的解决方案,使用 watch 来跟踪更新间隔,但我相信这个解决方案可以让我通过利用最近的 Android 功能来节省更多电池电量。

    最佳答案

    从文档:

    To also be notified of connection events relating to any PebbleKit companion apps associated with this watchapp, also assign a handler to the pebblekit_connection_handler field. This will be called when the status of the connection to the PebbleKit app changes.



    也许这就是你所需要的

    关于asynchronous - 在蓝牙连接事件中发送消息时不接收 AppMessage 回调,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35486745/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com