简体   繁体   English

Awareness API - Place type home

[英]Awareness API - Place type home

On google awareness API Guides page there is mention about Context types.在谷歌意识 API 指南页面上提到了上下文类型。

Contextual data includes sensor-derived data such as location (lat/lng), place (home, work, coffee shop)上下文数据包括传感器衍生的数据,例如位置(纬度/经度)、地点(家、工作场所、咖啡店)

However, on reference page with Places type Place reference , there is no mention about Home type.但是,在 Places 类型Place reference 的参考页面上,没有提及 Home 类型。 Is there a way to find out if user is at home (of course if he has it set up in his google settings)?有没有办法找出用户是否在家(当然,如果他在他的谷歌设置中设置了它)?

A bit late to the party, but now that Google's Awareness API has deprecated Places, you can use the NumberEight SDK as an alternative.参加聚会有点晚了,但现在 Google 的 Awareness API 已弃用 Places,您可以使用NumberEight SDK作为替代方案。 One bonus is that it works on iOS too.一个好处是它也适用于 iOS。

It performs a wide variety of context recognition tasks including:它执行各种上下文识别任务,包括:

  • Real-time physical activity detection实时身体活动检测
  • Current place categories (including Work and Home, which can trigger even without GPS)当前地点类别(包括工作和家庭,即使没有 GPS 也可以触发)
  • Motion detection移动侦测
  • Reachability可达性
  • Local weather当地天气

It can also record user context for reports and analysis via the online portal.它还可以通过在线门户记录用户上下文以进行报告和分析。

To quickly check when a user is at home in Kotlin, you would write:要在 Kotlin 中快速检查用户何时在家,您可以编写:

val ne = NumberEight()

ne.onPlaceUpdated { glimpse ->
    val place = glimpse.mostProbable

    if (place.context.home == Knowledge.AtPlaceContext) {
        Log.d("MyApp", "User is at home!")
    }
}

Here are some iOS and Android example projects.以下是一些iOSAndroid示例项目。

Disclosure: I'm one of the developers.披露:我是开发人员之一。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM