Google play billing library version 5
Google Play Billing Library version 5 is now available! This new version includes a number of new features and improvements, including:
– Improved support for in-app podcasts
– New APIs for managing subscriptions
– Improved support for consumable and non-consumable in-app items
We’re excited to offer these new features to our developers, and we can’t wait to see what you build with them!
Google Play billing library version 5 New Update
The Google play billing library version 5 is out and it’s chock-full of improvements! With this new version, you’ll be able to more easily manage in-app purchases, subscription renewals, and even refunds. Plus, the new version comes with a host of bug fixes and performance improvements.
If you’re an Android developer, then you’ll definitely want to check out the new Google play billing library. So head on over to the Google Developer website and get started today!
Read More : Google play billing library version 4 | In App Purchase
Start Code
implementation ‘com.github.akshaaatt:Google-IAP:1.2.5’
=====================================
MutableLiveData<Boolean> isBillingClientConnected = new MutableLiveData<>();
================================
isBillingClientConnected.setValue(false);
==================================
List<String> nonConsumablesList = Collections.singletonList(“lifetime”);
List<String> consumablesList = Arrays.asList(“1dollar”, “2dollar”, “3dollar”, “4dollar”, “5dollar”,”6dollar”);
List<String> subsList = Collections.singletonList(“subscription”);
===================================
IapConnector iapConnector = new IapConnector(
this,
nonConsumablesList,
consumablesList,
subsList,
getResources().getString(R.string.license_key),
true
);
===================================
iapConnector.addBillingClientConnectionListener((status, billingResponseCode) -> {
Log.d(“KSA”, “This is the status: “+status+” and response code is: “+billingResponseCode);
isBillingClientConnected.setValue(status);
});
=====================================
iapConnector.addPurchaseListener(new PurchaseServiceListener() {
public void onPricesUpdated(@NotNull Map iapKeyPrices) {
}
public void onProductPurchased(@NonNull DataWrappers.PurchaseInfo purchaseInfo) {
if (purchaseInfo.getSku().equals(“1dollar”)) {
Toast.makeText(app_billing.this, “Thanks For Donate”, Toast.LENGTH_SHORT).show();
} else if (purchaseInfo.getSku().equals(“2dollar”)) {
Toast.makeText(app_billing.this, “Thanks For Donate”, Toast.LENGTH_SHORT).show();
} else if (purchaseInfo.getSku().equals(“3dollar”)) {
Toast.makeText(app_billing.this, “Thanks For Donate”, Toast.LENGTH_SHORT).show();
} else if (purchaseInfo.getSku().equals(“4dollar”)) {
Toast.makeText(app_billing.this, “Thanks For Donate”, Toast.LENGTH_SHORT).show();
} else if (purchaseInfo.getSku().equals(“5dollar”)) {
Toast.makeText(app_billing.this, “Thanks For Donate”, Toast.LENGTH_SHORT).show();
} else if (purchaseInfo.getSku().equals(“6dollar”)) {
Toast.makeText(app_billing.this, “Thanks For Donate”, Toast.LENGTH_SHORT).show();
}
}
public void onProductRestored(@NonNull DataWrappers.PurchaseInfo purchaseInfo) {
}
});
====================================
iapConnector.addSubscriptionListener(new SubscriptionServiceListener() {
public void onSubscriptionRestored(@NonNull DataWrappers.PurchaseInfo purchaseInfo) {
}
public void onSubscriptionPurchased(@NonNull DataWrappers.PurchaseInfo purchaseInfo) {
if (purchaseInfo.getSku().equals(“subscription”)) {
}
}
public void onPricesUpdated(@NotNull Map iapKeyPrices) {
}
});
==================================================================
one.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
iapConnector.purchase(app_billing.this, “1dollar”);
}
});
two.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
iapConnector.purchase(app_billing.this, “2dollar”);
}
});
three.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
iapConnector.purchase(app_billing.this, “3dollar”);
}
});
four.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
iapConnector.purchase(app_billing.this, “4dollar”);
}
});
five.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
iapConnector.purchase(app_billing.this, “5dollar”);
}
});
End of Code
Read More: Free RDP Trick (100% Working) | How to get Lifetime Free RDP
If Any Issue
If you have any issues, please feel free to comment below us and we will get back to you as soon as possible. Thank you for your cooperation!
If you enjoy our blog, be sure to Subscribe for more. We release new episodes every week, and we love hearing from our listeners. You can also connect with us on social media to stay up-to-date on all things podcast-related. We can’t wait to chat with you more about all things business!