Google Fit 停止工作,"Fitness.HistoryApi.insertData" returns 成功但未显示在 Google Fit 应用程序中
Google Fit stopped working, "Fitness.HistoryApi.insertData" returns success but doesn't shows up in Google Fit application
我的应用程序中实现的代码曾经有效,inserted/displayed 中的数据 Google 正确,但现在不起作用。
我也测试了 BasicHistoryApi
但它不起作用。(https://github.com/googlesamples/android-fit)
此测试应用 returns 没有错误的屏幕截图:
如果您使用此方法Fitness.HistoryApi.insertData()
并且它工作正常,请告诉我,因为我找不到任何解决方案来使其工作。
此代码片段 returns "success",但我的 Google 没有变化:
DataSet runningDataSet = DataSet.create(runningDataSource);
runningDataSet.add(runningDataSet.createDataPoint().setTimeInterval(
startTime, endTime, TimeUnit.MILLISECONDS));
Session session = new Session.Builder().setName("TEST " + startTime)
.setDescription("Test description")
.setIdentifier("TEST " + " - " + startTime)
.setActivity(FitnessActivities.RUNNING_JOGGING)
.setStartTime(startTime, TimeUnit.MILLISECONDS)
.setEndTime(endTime, TimeUnit.MILLISECONDS).build();
SessionInsertRequest insertRequest = new SessionInsertRequest.Builder()
.setSession(session).addDataSet(runningDataSet).build();
Log.i(TAG, "Inserting the session in the History API");
com.google.android.gms.common.api.Status insertStatus = Fitness.SessionsApi
.insertSession(MainActivity.getFitnessClient(), insertRequest)
.await(1, TimeUnit.MINUTES);
if (!insertStatus.isSuccess()) {
Log.i(TAG, "There was a problem inserting the session: "
+ insertStatus.getStatusMessage());
您没有付出太多努力,但身份验证发生了变化。见 Announcement one the Google Fit developers G+ page
最后,我通过将“.setDataType(DataType.TYPE_ACTIVITY_SEGMENT)”替换为“.setDataType(DataType.TYPE_SPEED)”解决了这个问题,我不得不添加一个新权限:"addScope(new Scope(Scopes.FITNESS_LOCATION_READ_WRITE))"
我的应用程序中实现的代码曾经有效,inserted/displayed 中的数据 Google 正确,但现在不起作用。
我也测试了 BasicHistoryApi
但它不起作用。(https://github.com/googlesamples/android-fit)
此测试应用 returns 没有错误的屏幕截图:
如果您使用此方法Fitness.HistoryApi.insertData()
并且它工作正常,请告诉我,因为我找不到任何解决方案来使其工作。
此代码片段 returns "success",但我的 Google 没有变化:
DataSet runningDataSet = DataSet.create(runningDataSource);
runningDataSet.add(runningDataSet.createDataPoint().setTimeInterval(
startTime, endTime, TimeUnit.MILLISECONDS));
Session session = new Session.Builder().setName("TEST " + startTime)
.setDescription("Test description")
.setIdentifier("TEST " + " - " + startTime)
.setActivity(FitnessActivities.RUNNING_JOGGING)
.setStartTime(startTime, TimeUnit.MILLISECONDS)
.setEndTime(endTime, TimeUnit.MILLISECONDS).build();
SessionInsertRequest insertRequest = new SessionInsertRequest.Builder()
.setSession(session).addDataSet(runningDataSet).build();
Log.i(TAG, "Inserting the session in the History API");
com.google.android.gms.common.api.Status insertStatus = Fitness.SessionsApi
.insertSession(MainActivity.getFitnessClient(), insertRequest)
.await(1, TimeUnit.MINUTES);
if (!insertStatus.isSuccess()) {
Log.i(TAG, "There was a problem inserting the session: "
+ insertStatus.getStatusMessage());
您没有付出太多努力,但身份验证发生了变化。见 Announcement one the Google Fit developers G+ page
最后,我通过将“.setDataType(DataType.TYPE_ACTIVITY_SEGMENT)”替换为“.setDataType(DataType.TYPE_SPEED)”解决了这个问题,我不得不添加一个新权限:"addScope(new Scope(Scopes.FITNESS_LOCATION_READ_WRITE))"