【问题标题】:Minimum required API for using ActivityRecognitionApi via GoogleApiClient通过 GoogleApiClient 使用 ActivityRecognitionApi 所需的最低 API
【发布时间】:2015-12-28 13:55:29
【问题描述】:

为了识别用户的身体活动(如静止、行走、跑步等),应用可以使用谷歌提供的ActivityRecognitionAPI。

我已经在安卓 5.1.1 版本的 Nexus 6 上成功实现并测试了它。由于我的应用程序将支持 14 的最低 sdk 版本(Android 4.0 版本),我想知道 ActivityRecognitionAPI 支持的最低 sdk 版本是多少。我已经尝试阅读文档here,但找不到问题的答案。

经过一番研究,我发现 ActivityRecognitionAPI 使用 GoogleApiClient 进行订阅,而 GoogleApiClient 依赖于 Google Play Services。但是现在支持 ActivityRecognitionAPI 所需的最低 Google Play 服务版本是多少?如果我误解了什么,任何帮助都会非常感激和道歉。

【问题讨论】:

  • 看起来 API 被捆绑为库的一部分,因此 14 的最小 sdk 应该没问题。您需要检查用户是否在他们的设备上安装了 Google Play 服务,一些 API 已经这样做了。我建议在没有 Google Play 服务和 API 级别 14 的设备上进行测试。
  • @riggaroo 我已经实现了通过 onConnectionFailed 方法提供 ConnectionResult 的 GoogleApiClient.OnConnectionFailedListener。如果设备上未安装 Google Play 服务,这还会告诉应用程序。

标签: android activity-recognition


【解决方案1】:

根据文档中的this 页面,真实设备的最低 API 版本为 9,而模拟器的最低 API 版本为 17,因为只有从这个版本开始,设备才会获得 Google API 更新:

要在使用 Google Play 服务 SDK 时测试您的应用,您必须使用:

  • 运行 Android 2.3 或更高版本并包含 Google Play 商店的兼容 Android 设备。
  • 带有 AVD 的 Android 模拟器运行基于 Android 4.2.2 或更高版本的 Google API 平台。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-05-16
    • 1970-01-01
    • 1970-01-01
    • 2014-08-27
    • 2013-04-27
    • 1970-01-01
    • 1970-01-01
    • 2017-12-31
    相关资源
    最近更新 更多