如何禁用谷歌飞度和撤销由应用程序本身的权限飞度、应用程序、权限

2023-09-07 16:08:09 作者:Love Story 爱情故事

我有一个连接到谷歌飞度,读取和有关用户身上写一些数据设置应用。当用户在应用程序设置禁止谷歌飞度,我试图通过调用撤销我的应用程序权限:

I've setup app that connects to Google Fit, reads and writes some data about users body. When user disables Google Fit in apps settings, I try to revoke my apps permissions for by calling:

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);
            }
        }
    });
}

虽然我可以成功地读/写数据,禁用飞度返回我的错误:

Even though I could successfully read/write data, disabling Fit returns me error:

Google Fit wasn't disabled Status
{statusCode=unknown status code: 5010, resolution=null}

EDIT1:添加整个方法,其中,其可见光,客户端连接在那一刻我尝试做禁用适合

Added whole method, in which its visible, that client is connected at the moment I try do disable Fit.

推荐答案

禁用电话后

mClient.disconnect();

这是我工作

 
精彩推荐
图片推荐