Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to correctly import BillingResponse with newest version of billing client (billing:2.0.1)

I'm upgrading my version of android billing api from 1.2.2 to 2.0.1. But now my import of the '''BillingResponse''' api is returning an error. How can I properly import BillingResponse with version 2.0.1?

I'm working with gradle inside of Android Studio.

I've tried: - Cleaning and rebuilding my project - Closing the application and reopening - Restarting my machine - File > Sync project with gradle files

None of those worked so far with 2.0.1, but when I go back to 1.2.2 version of the android billing API it works again! I could not find any documentation that BillingResponse had been deprecated so I was expecting it to work even with an updated api


My relevant gradle dependencies:

dependencies {
  implementation fileTree(dir: 'libs', include: ['*.jar'])
  implementation project(':libcocos2dx')
  implementation 'com.google.android.gms:play-services-games:17.0.0'
  implementation 'com.google.android.gms:play-services-auth:16.0.1'
  implementation 'com.android.billingclient:billing:2.0.1'

My import statements inside of BillingProvider.java which implements PurchasesUpdatedListener:

import com.android.billingclient.api.BillingClient;
import com.android.billingclient.api.BillingClient.BillingResponse;
import com.android.billingclient.api.BillingClient.FeatureType;
import com.android.billingclient.api.BillingClient.SkuType;

^ note that all of the other imports are working here except the .BillingResponse one!

I expected the BillingResponse to still be available in 2.0.1 but it can't seem to find it now that I have upgraded...

like image 774
thefliptrickster Avatar asked Jul 03 '19 19:07

thefliptrickster


1 Answers

Check https://developer.android.com/google/play/billing/billing_library_releases_notes

BillingResult return values

APIs that previously returned a BillingResponse integer value now return a BillingResult object. BillingResult contains the BillingResponse integer as well as a debug string that you can use to diagnose errors. The debug string uses an en-US locale and is not meant to be shown to end users.

like image 155
second Avatar answered Nov 15 '22 20:11

second