To use the Google Play Services, you need to be connected with Google. I get that the FusedProviderApi, for example, may scan for WiFi APs or Cell tower Ids and send them to Google to be chewed and output a location. But this activity detection shouldn't be much of a hassle, so what is happening? This is what they say they do:

"The activities are detected by periodically waking up the device and reading short bursts of sensor data. It only makes use of low power sensors in order to keep the power usage to a minimum. For example, it can detect if the user is currently on foot, in a car, on a bicycle or still."

Do they need to chew the low power (accelerometer/magnetometer/gyroscope) sensors data in their server as well? Or are they just collecting that info to build some crowd sourced model? Can I detect activity even if I don't have a connection to their server at the time? Or will it store the periodically taken measurements until it has a connection to their server? Has anyone tried this?

EDIT: After testing I found out the .connect() call, despite its semantics, does not necessarily make a connection to anything, as you can perform it without an internet connection. This method (and the onConnect() callbacks) led me to think a connection to their server would have to take place when it's not the case. Marking cYrixmorten's answer as correct.

1

There are 1 answers

0
cYrixmorten On BEST ANSWER

I think it just needs to

  1. confirm you have a proper apiClient within that part of the code
  2. potentially update the patterns for which it matches against.

I do not think it invokes any connections back to Google Play Services as their sample project disconnects from it right after requesting activity recognition.

To avoid having to do the cumbersome work of setting up ApiClient etc. I have added Activity Recognition to this library: https://github.com/mcharmas/Android-ReactiveLocation