Hey everyone! Here is a new article under my series of Quick Tips posts. What is this series of posts about? (I hope you asked yourself ☺️). Well, you know when you want to implement a functionality or do something technical that is well documented, but the documentation for that specific thing is not centralized? (I hope you do, cause I often struggle with that). Each post in this series is a kind of centralized documentation for a feature it covers.

Today, we’re going to debug Google Play Billing in Xamarin Android Apps. When you configure Google billing on the play store console, you obviously will need to debug and test purchases before deploying your app. This is well documented online, but I’ll save you time and place steps to accomplish this easily.

NOTE:

  • This post assumes you’ve already set up Google Play Billing on your Google Play Console.
  • I have to mention that, I use this awesome plugin to implement In-app Billing in my apps.

Adding License Testers to Google Play

The first thing you want to do is tell Google Play that when it notices that in-app billing on your app is called with your email or your tester’s email, it should display test credit cards to avoid charging you real money. You do this by adding your email or your test user’s email to the license testers list.

  • Navigate to the License testing page in Google play console as shown below, or search “License testing” in the search box.
Debug Google Play Billing in Xamarin Android Apps
Debug Google Play Billing in Xamarin Android Apps

Telling Xamarin to sign my debug package

One problem with in-app billing on Android is that you can only activate it if your package is signed. That is why we need to sign our package though we are debugging. Luckily for us, it is easy in Xamarin Android.

  • Open your Android project’s csproj file.
  • Locate the debug section in the XML file and add the following, by replacing the values in braces with your signing certificate credentials.

The above will make every debug package be signed before deployment.

References

https://support.google.com/googleplay/android-developer/answer/6062777?hl=en

Follow me on social media and stay updated

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.