从谷歌的行为识别结果的间隔不规律 [英] The interval of results from Google's activity recognition isn't regular
问题描述
我正在对谷歌的行为识别,最后我从这种服务的结果。
I was working on google's activity recognition and finally I got results from this service.
但是,函数 requestActivityUpdates(长detectionIntervalMillis,的PendingIntent callbackIntent)
似乎并没有正常工作。检测间隔不规律,当我目前活动正在改变下降到30〜50秒。它并不像谷歌I / O 2013的现场演示工作(谷歌I / O 2013位置API ,从27:47至28:45)。没有人有这同样的问题?
However, The function requestActivityUpdates(long detectionIntervalMillis, PendingIntent callbackIntent)
doesn't seem to work correctly. The detection interval is not regular and decreases to 30~50 seconds when my current activity is changing. It doesn't work like the live demo on google I/O 2013 (Google I/O 2013 Location API, from 27:47 to 28:45). Does anyone have same issue on it?
推荐答案
而不是将构建()部分,直接尝试添加下面的方法,并调用它的onCreate()。并试图追溯从code <一个href=\"https://github.com/googlesamples/android-play-location/blob/master/ActivityRecognition/app/src/main/java/com/google/android/gms/location/sample/activityrecognition/MainActivity.java\"相对=nofollow>谷歌样品我得到了code从样品剥离下来。
Instead of adding the build() part on onCreate directly try adding the method below and call it on onCreate(). And try to trace the code from google sample I got the code stripped down from that sample.
protected synchronized void buildGoogleApiClient() {
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(ActivityRecognition.API)
.build();
}
和增加 buildGoogleApiClient()
您onCreate方法;!)这对我的伟大工程
and add buildGoogleApiClient()
to your onCreate method ;) this works great for me!
这篇关于从谷歌的行为识别结果的间隔不规律的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!