简体   繁体   English

总能联系到计费客户

[英]Billing client is always reached

I am executing the code described by the google billing library, but my device always connects to the billing client, also if I m in flight mode.我正在执行谷歌计费库描述的代码,但我的设备始终连接到计费客户端,即使我处于飞行模式也是如此。

//Initiate billing client
        bc = BillingClient.newBuilder(getApplicationContext()).setListener(this).
enablePendingPurchases().build();
        bc.startConnection(new BillingClientStateListener() {
            @Override
            public void onBillingSetupFinished(BillingResult billingResult) {
                if (billingResult.getResponseCode() ==  BillingClient.BillingResponseCode.OK) {
                    // The BillingClient is ready. You can query purchases here.
                    Toast.makeText(getApplicationContext(), "Connected", Toast.LENGTH_SHORT).show();
                }
            }
            @Override
            public void onBillingServiceDisconnected() {
                // Try to restart the connection on the next request to
                // Google Play by calling the startConnection() method.
                Toast.makeText(getApplicationContext(), "Failure", Toast.LENGTH_SHORT).show();
            }
        });

Google Play services cache purchases, so it is available offline Google Play 服务缓存购买,因此可以离线使用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM