计费客户始终联系
Billing client is always reached
我正在执行 google 计费库描述的代码,但我的设备始终连接到计费客户端,即使我处于飞行模式也是如此。
//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 服务缓存购买,因此可以离线使用
我正在执行 google 计费库描述的代码,但我的设备始终连接到计费客户端,即使我处于飞行模式也是如此。
//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 服务缓存购买,因此可以离线使用