BillingClient always returns SERVICE_DISCONNECTED

邮差的信 提交于 2019-12-05 08:38:23

Turns out I was not using a version of my apk that was signed with the right version numbering and such. Once I fixed that I was able to connect to play services and figure out what i wanted.

I came across this problem. Be also sure to start the connection:

mBillingClient = BillingClient.newBuilder(mContext).setListener(purchasesUpdatedListener).build();

        mBillingClient.startConnection(new BillingClientStateListener() {
            @Override
            public void onBillingSetupFinished(@BillingClient.BillingResponse int billingResponseCode) {
                if (billingResponseCode == BillingClient.BillingResponse.OK) {

                    Log.d(TAG, "onBillingSetupFinished: BillingClient.BillingResponse.OK ");

                }


            }
            @Override
            public void onBillingServiceDisconnected() {
                // Try to restart the connection on the next request to
                // Google Play by calling the startConnection() method.
            }


        });
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!