I had a code working that was using Google\'s Activity Recognition Updates. Now all of a sudden these seem to send updates either several times per second or never although requ
As suggested by canopi, increase the detection 'time', in which 0 will give you the fastest result.
I had encountered the same problem and instead of adding the build() part on onCreate directly, I added the method below and called it on onCreate(). Try to trace the code from this google sample. I got the code stripped down from there.
protected synchronized void buildGoogleApiClient() {
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(ActivityRecognition.API)
.build();
}
Also add buildGoogleApiClient()
to your onCreate method.