6

On google awareness API Guides page there is mention about Context types.

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. Is there a way to find out if user is at home (of course if he has it set up in his google settings)?

StephenKing
  • 36,187
  • 11
  • 83
  • 112
poss
  • 1,759
  • 1
  • 12
  • 27

1 Answers1

0

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. One bonus is that it works on iOS too.

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)
  • 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:

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.

Disclosure: I'm one of the developers.

Chris Watts
  • 6,197
  • 7
  • 49
  • 98