相关疑难解决方法(0)

如何从应用程序本身禁用Google Fit并撤消权限

我已经设置了连接到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);
            }
        }
    });
}
Run Code Online (Sandbox Code Playgroud)

即使我可以成功读取/写入数据,禁用Fit也会返回错误:

Google Fit wasn't disabled Status
{statusCode=unknown status code: 5010, resolution=null}
Run Code Online (Sandbox Code Playgroud)

Edit1:添加了整个方法,其中可见,该客户端在我尝试禁用Fit时连接.

android google-fit

8
推荐指数
2
解决办法
6851
查看次数

在google fit中获取错误"连接失败.原因:ConnectionResult {statusCode = unknown status code 5005,resolution = null}"

我试图使用谷歌适合开发应用程序.我关注链接

当我尝试运行该应用程序时,我收到以下错误

10-27 11:55:19.966:I/Google Fit(6016):连接失败.原因:ConnectionResult {statusCode =未知状态代码5005,分辨率= null}

10-27 11:55:19.966:E/GooglePlayServicesUtil(6016):意外错误代码5005

google-api google-play-services google-fit android-5.0-lollipop

4
推荐指数
1
解决办法
4172
查看次数