我已经设置了连接到Google Fit的应用,可以读取和写入有关用户身体的一些数据.当用户在应用设置中停用Google健身时,我会尝试通过以下方式撤消我的应用权限:
public void disableGoogleFit(){ if(!mClient.isConnected()){ Log.e(TAG,"Google Fit wasn't connected"); return; } PendingResult<Status> pendingResult = Fitness.ConfigApi.disableFit(mClient); pendingResult.setResultCallback(new ResultCallback<Status>() { @Override public void onResult(Status status) { if(status.isSuccess()) { Log.i(TAG,"Google Fit disabled"); }else{ Log.e(TAG,"Google Fit wasn't disabled " + status); } } }); }
即使我可以成功读取/写入数据,禁用Fit也会返回错误:
Google Fit wasn't disabled Status {statusCode=unknown status code: 5010,resolution=null}