JP711
JP711

Reputation: 695

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?

Upvotes: 11

Views: 2763

Answers (2)

Bona Fide
Bona Fide

Reputation: 1067

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()).

Upvotes: 34

CDoubleU
CDoubleU

Reputation: 41

Please do not rely on AI when you need 100% precise answers. AI can give you good hints where to start your search. But it is not a documentation. AI gives you the most LIKELY answer it can calculate, that might not be 100% correct. (Sorry for writing a whole post, but I'm not yet allowed to write comments. :( )

So, the answer from Bona Fide is correct.

Upvotes: 1

Related Questions