【问题标题】:Billing client is always reached始终联系到计费客户
【发布时间】:2020-05-04 11:00:30
【问题描述】:

我正在执行谷歌计费库描述的代码,但我的设备始终连接到计费客户端,即使我处于飞行模式也是如此。

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

【问题讨论】:

    标签: android android-studio billing


    【解决方案1】:

    Google Play 服务缓存购买,因此可以离线使用

    【讨论】:

      猜你喜欢
      • 2020-11-02
      • 2017-05-12
      • 1970-01-01
      • 1970-01-01
      • 2018-12-19
      • 1970-01-01
      • 1970-01-01
      • 2018-08-01
      • 2020-04-07
      相关资源
      最近更新 更多