Skip to content

Instantly share code, notes, and snippets.

@ponnamkarthik
Last active July 28, 2018 23:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ponnamkarthik/828f8ff63d48a1f474fc62552010d999 to your computer and use it in GitHub Desktop.
Save ponnamkarthik/828f8ff63d48a1f474fc62552010d999 to your computer and use it in GitHub Desktop.
In-app Billing Initalise
BillingClient mBillingClient;
mBillingClient = BillingClient.newBuilder(this).setListener(new PurchasesUpdatedListener() {
@Override
public void onPurchasesUpdated(int responseCode, @Nullable List<Purchase> purchases) {
for(Purchase purchase: purchases) {
//When every a new purchase is made
}
}
}).build();
mBillingClient.startConnection(new BillingClientStateListener() {
@Override
public void onBillingSetupFinished(@BillingClient.BillingResponse int billingResponseCode) {
if (billingResponseCode == BillingClient.BillingResponse.OK) {
// The billing client is ready. You can query purchases here.
}
}
@Override
public void onBillingServiceDisconnected() {
// Try to restart the connection on the next request to
// Google Play by calling the startConnection() method.
}
});
@Zennaxxtech
Copy link

I am newbie, I am trying to integrate in-app subscription last two day. I have done with another lib and test it by uploading apk on Alpha testing. My payment was successful but with that lib i am getting 102 error. so i am trying to implement in-app subscription using this lib but not getting idea that how to make request for subscription and how to check that my subscription is activated or not. And if subscription is successfully activated then how to check that user has cancelled subscription or not for second time when user start the app? Please do some help, i would be very appreciative.

@JohhSonic
Copy link

add

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment