Hello,
Starting from Android 12 (API level 31), the billing library no longer requires this permission. Instead, it uses Play Billing Library 4.0, which handles all billing transactions internally and does not require a separate permission.
To implement in-app billing functionality in your app, you should now use the Xamarin.Android.Google.BillingClient nugget package and implement the necessary code for purchasing and managing in-app products.
Here is an example of how to implement in-app billing using Xamarin.Android.Google.BillingClient nugget package.
Firstly, Initialize an instance of the BillingClient
#if ANDROID
BillingClient billingClient = BillingClient
.NewBuilder(Microsoft.Maui.MauiApplication.Context)
.EnablePendingPurchases().SetListener(new PerchasesUpdateListener())
.Build();
billingClient.StartConnection(ConnectionListener,DisConnectEvent);
#endif
ConnectionListener listens for changes in the connection status with the Google Play Billing service.
#if ANDROID
private void DisConnectEvent()
{
//throw new NotImplementedException();
}
private void ConnectionListener(BillingResult obj)
{
// throw new NotImplementedException();
}
#endif
Then Implement the IPurchasesUpdatedListener interfaces: IPurchasesUpdatedListener handles the result of the purchase flow and updates the UI accordingly.
#if ANDROID
internal class PerchasesUpdateListener:Java.Lang.Object, IPurchasesUpdatedListener
{
public PerchasesUpdateListener()
{
}
public void OnPurchasesUpdated(BillingResult p0, IList<Purchase> p1)
{
throw new NotImplementedException();
}
}
#endif
For more details, you can check this google billing document.
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.