有没有人浏览过Google-Play-Services API文档,并在v6.5和7.0.0之间找出了语法上的变化?
寻找婴儿床单,以免我自己编译,例如
v< 7语法:
mClient = new GoogleApiClient.Builder(this)
.addApi(Fitness.API)
....
// Begin by creating the query.
DataReadRequest readRequest = queryFitnessData();
DataReadResult dataReadResult =
Fitness.HistoryApi.readData(mClient, readRequest).await(1, TimeUnit.MINUTES);
....
Status insertStatus = Fitness.HistoryApi.insertData(mClient, dataSet)
.await(1, TimeUnit.MINUTES);
成为v> = 7.0.0:
mClient = new GoogleApiClient.Builder(this)
.addApi(Fitness.HISTORY_API)
....
// Begin by creating the query.
DataReadRequest readRequest = queryFitnessData();
PendingResult<DataReadResult> pendingResult = Fitness.HistoryApi.readData(
mClient,
readRequest);
DataReadResult readDataResult = pendingResult.await();
....
PendingResult<Status> pendingStatus = Fitness.HistoryApi.insertData(mClient, dataSet);
Status insertStatus = pendingStatus.await();
我也想知道Getting Started页面上的 GoogleApiClient.Builder(this)... if(!authInProgress)示例块是否也应该捕获 ConnectionResult。 SIGN_IN_REQUIRED 结果?
我问,自从搬到最新版本后我偶然注意到:
google fit Connection failed. Cause: ConnectionResult{statusCode=SIGN_IN_REQUIRED,
错误,所以想知道而不是建议:
mClient = new GoogleApiClient.Builder(this)
....
if (!authInProgress) {
if (result.getErrorCode() == FitnessStatusCodes.NEEDS_OAUTH_PERMISSIONS) {
我们/该网站应该使用:
mClient = new GoogleApiClient.Builder(this)
....
if (!authInProgress) {
if (result.getErrorCode() == FitnessStatusCodes.NEEDS_OAUTH_PERMISSIONS
|| result.getErrorCode() == ConnectionResult.SIGN_IN_REQUIRED
) {