- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在为 Android Wear 开发表盘。我想在脸上显示仅由穿戴设备记录的步骤。根据谷歌文档,这可以通过 HistoryApi.readDailyTotal() 实现。
根据文档:
The system does not require authorization to access the TYPE_STEP_COUNT_DELTA data type from the HistoryApi.readDailyTotal() method. This can be useful if you require step data for use in areas where you are unable to show the permissions panel (for example, Android Wear watch faces and activities or widget activities). For more information on how to use this data in a watch face, see Showing Information in Watch Faces.
不幸的是,这对我不起作用 - GoogleApiClient 总是返回连接失败:5 - 这意味着:客户端尝试使用指定的无效帐户名连接到服务。
这是我的客户:
mFitnessApiClient = new GoogleApiClient.Builder(MyWatchFace.this)
.addApi(Fitness.HISTORY_API)
.addScope(Fitness.SCOPE_ACTIVITY_READ)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
知道如何解决这个问题吗?我在这方面遇到了困难。
最佳答案
我在获取可穿戴设备(仅限本地)上的总数时遇到了类似的问题,这对我有用:不要添加任何范围,并确保调用 useDefaultAccount。希望这可以帮助!例如:
mFitnessApiClient = new GoogleApiClient.Builder(MyWatchFace.this)
.addApi(Fitness.HISTORY_API)
// Do not add any scopes if using the client on the watch
.addConnectionCallbacks(this)
.useDefaultAccount() // Use the default account
.addOnConnectionFailedListener(this)
.build();
关于android - HistoryApi.readDailyTotal() 不适用于 Wear 设备,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33035757/
我正在为 Android Wear 开发表盘。我想在脸上显示仅由穿戴设备记录的步骤。根据谷歌文档,这可以通过 HistoryApi.readDailyTotal() 实现。 根据文档: The sys
我的应用程序中实现的代码曾经有效,数据已正确插入/显示在 Google Fit 中,但现在不起作用。 我还测试了 BasicHistoryApi 但它不起作用。( https://github.com
我是一名优秀的程序员,十分优秀!