本文介绍了Fitness.API在谷歌Play中删除服务7.0?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

升级到谷歌播放服务7.0后,我的 GoogleApiClient code,用于连接到谷歌飞度不再起作用:它说:

我在哪里code为建设 GoogleApiClient 是:

  mGoogleApiClient =新GoogleApiClient.Builder(本)
    .addApi(Fitness.API)
    .addScope(新范围(Scopes.FITNESS_ACTIVITY_READ_WRITE))
    .addConnectionCallbacks(本)
    .addOnConnectionFailedListener(本)
    。建立();
 

解决方案

每Google播放服务7.0博客帖子:

因此​​,你应该更新你的 GoogleApiClient 来增加大家使用适当的API。例如,如果你使用 SensorsApi RecordingApi ,您的code应该像两个:

  mGoogleApiClient =新GoogleApiClient.Builder(本)
    .addApi(Fitness.SENSORS_API)
    .addApi(Fitness.REPORTING_API)
    .addScope(新范围(Scopes.FITNESS_ACTIVITY_READ_WRITE))
    .addConnectionCallbacks(本)
    .addOnConnectionFailedListener(本)
    。建立();
 

注:编译老版本的谷歌Play业务应用程序将继续工作,但不会得到随附分裂的API在谷歌Play业务7.0中提到的同一篇博客文章中存储的好处:

After upgrading to Google Play Services 7.0, my GoogleApiClient code for connecting to Google Fit no longer works: it says:

Where my code for building the GoogleApiClient is:

mGoogleApiClient = new GoogleApiClient.Builder(this)
    .addApi(Fitness.API)
    .addScope(new Scope(Scopes.FITNESS_ACTIVITY_READ_WRITE))
    .addConnectionCallbacks(this)
    .addOnConnectionFailedListener(this)
    .build();
解决方案

Per the Google Play services 7.0 blog post:

Therefore you should update your GoogleApiClient to add all of the appropriate APIs you use. For example, if you use both the SensorsApi and the RecordingApi, your code should look like:

mGoogleApiClient = new GoogleApiClient.Builder(this)
    .addApi(Fitness.SENSORS_API)
    .addApi(Fitness.REPORTING_API)
    .addScope(new Scope(Scopes.FITNESS_ACTIVITY_READ_WRITE))
    .addConnectionCallbacks(this)
    .addOnConnectionFailedListener(this)
    .build();

Note: apps compiled against older versions of Google Play services will continue to work, but won't get the memory benefit that comes with the split APIs in Google Play services 7.0 as mentioned in the same blog post:

这篇关于Fitness.API在谷歌Play中删除服务7.0?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 07:42