Using sample library for in-app billing in Android: Interface created by IInAppBillingService.aidl

StackOverflow https://stackoverflow.com/questions/14718333

  •  06-03-2022
  •  | 
  •  

Question

With Google's new in-app billing library (version 3), it should be significantly easier to add billing to one's applications. The code shown in the developers blog (see link) looks quite simple already.

However, I came across the sample application in the SDK's folder extras\google\market_billing\in-app-billing-v03. It's called "TrivialDrive".

When I tried to use the sample code, some questions raised:

  1. Is pasting the IInAppBillingService.aidl file into the new package com.android.vending.billing correct? The Java interface that is created then shows two to-do messages for me, e.g. in getBuyIntent(): "TODO: change this to app-specific keys". Doesn't sound good. Is this interface production-ready, though?
  2. There's a folder util in the sample's "src", containing IabHelper, Base64, Purchase and other classes. Can I simply copy that directory and use all these helper functions as they are?
Was it helpful?

Solution

You are probably confusing the sample code with the generated AIDL stub. The implementation of the in-app billing service is in the Google Play Store client, the AIDL file is just a means to call it (using RPC). You are supposed to change the sample code in order to get it work with your account, key and items. As for the code in util, the license is permissive, so you can copy it and use it. You can, of course, build your own library from scratch, by only calling the IInAppBillingService using the generated stub.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top