javaandroidandroid-billingplay-billing-library

enablePendingPurchases was deprecated in version 7 of the google billing library


When updating the Google Billing Library to version 7 it marks the enablePendingPurchases() method as obsolete.

Reading the documentation it seems we now need to pass a PendingPurchasesParams object as a parameter to the new enablePurchases() method.

Reading the documentation for PendingPurchasesParams it only has the newBuilder method so I don't know if I could simply use:

billingClient = BillingClient.newBuilder(Settings.this)
                    .setListener(purchasesUpdatedListener)
                    .enablePendingPurchases(PendingPurchasesParams.newBuilder().build())
                    .build();

Or how should I handle this situation?


Solution

  • If you want the same behavior as previously, use the following as stated in the Google Play Billing Library 7.0.0 release notes.

    The deprecated enablePendingPurchases() is functionally equivalent to enablePendingPurchases(PendingPurchasesParams.newBuilder().enableOneTimeProducts().build()).