gpt4 book ai didi

android - WearableListenerService 有多贵? (穿奥斯)

转载 作者:行者123 更新时间:2023-12-05 00:17:50 26 4
gpt4 key购买 nike

我正在开发一个带有配套移动应用程序的新穿戴应用程序。
很少需要通过蓝牙连接将信息从手机传输到 watch 。
主要的穿戴应用程序是独立的,因此从手机传输数据是一种奢侈,因为它会比在 watch 上更方便地设置用户偏好(虽然设置菜单也会存在于 watch 上)。
所以我在两个选择之间进退两难:

  • 仅当应用程序在 watch 上打开时才能收听通过蓝牙连接发送的消息。
    优势 这是资源节约和效率(但问题是多少)。
    劣势是一个较小的用户体验。
  • 设置 WearableListenerService它将始终收听来自手机的消息。
    优势 这是一种高用户体验,因为用户不必在 watch 上打开应用程序即可传输数据。
    劣势这是资源的浪费(又是多少的问题)。

  • 我应该怎么办? WearableListenerService有多贵特别是在系统资源和电池生命周期方面?

    最佳答案

    根据 WearableListenerService docs :

    The life-cycle of this service is managed by Android Wear. This service will be bound to and events delivered as a result of various Android Wear events, including data, messages and events indicating a device has connected or disconnected from the Android Wear network.


    这意味着该服务仅在 Wear 有数据、消息等要交付给您的应用程序时创建 - 当没有任何东西要交付时,该服务将被销毁并且不占用任何资源。
    如果您希望在进程尚未打开时接收回调,则执行 WearableListenerService正是你应该做的。

    关于android - WearableListenerService 有多贵? (穿奥斯),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71178766/

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