com.android.billingclient.api.PurchasesUpdatedListener Java Examples

The following examples show how to use com.android.billingclient.api.PurchasesUpdatedListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AccelerateDevelop.java    From InviZible with GNU General Public License v3.0 6 votes vote down vote up
public void initBilling() {
    mBillingClient = BillingClient.newBuilder(activity)
            .enablePendingPurchases()
            .setListener(new PurchasesUpdatedListener() {
                @Override
                public void onPurchasesUpdated(BillingResult billingResult, @Nullable List<Purchase> purchasesList) {
                    if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK && purchasesList != null) {
                        Log.i(LOG_TAG, "Purchases are updated");
                        handlePurchases(purchasesList);
                    }
                }
            }).build();

    CachedExecutor.INSTANCE.getExecutorService().submit(() -> {
        mBillingClient.startConnection(AccelerateDevelop.this);
    });
}