Error in Fragment: “Already managing a GoogleApiClient with id 0”

后端 未结 10 1967
独厮守ぢ
独厮守ぢ 2020-12-13 08:16

Everything works right the first time, if you launch a second time you see this error:

FATAL EXCEPTION: main
Process         


        
10条回答
  •  旧时难觅i
    2020-12-13 09:02

    To avoid further issue

    @Override
    public void onStop() {
        super.onStop();
        if (mGoogleApiClient != null && mGoogleApiClient.isConnected()) {
            mGoogleApiClient.stopAutoManage((Activity) context);
            mGoogleApiClient.disconnect();
        }
    }
    

提交回复
热议问题