11

Why are there two versions of TrivialDrive?

https://github.com/googlesamples/android-play-billing

Which version should be the main reference project for learning in-app billing? What's the difference between the versions?

goRGon
  • 4,402
  • 2
  • 43
  • 45
user8251758
  • 143
  • 5

3 Answers3

3

A little searching shows that Trival Drive V2 sample has a shared build.gradle file:

https://github.com/googlesamples/android-play-billing/blob/master/TrivialDrive_v2/shared-module/build.gradle

which has the following line:

compile 'com.android.billingclient:billing:dp-1'

Looking at the documentation here:

https://developer.android.com/google/play/billing/billing_library.html

Shows that Google just released a new version of the Billing Library release dp-1:

Starting with Play Billing Library release dp-1 (June 2017), the minimum supported API level is Android 2.2 (API level 8). The minimum supported In-app Billing API is version 3.

And specifically calls out changes to the minimum support Android API and In-app Billing API.

Given the Trivial Drive V2 sample app(s) has a Wear 2.0 example - this version has billing support on Wear 2.0 apps.

Morrison Chang
  • 11,691
  • 3
  • 41
  • 77
  • 3
    I don't understand. https://developer.android.com/google/play/billing/billing_integrate.html (here it says to import the IInAppBillingService.aidl file) https://developer.android.com/training/play-billing-library/preparing-iab-app.html (here it says to look at Trivial Drive v2, and also use compile 'com.android.billingclient:billing:dp-1' instead of importing the .aidl file) https://developer.android.com/training/in-app-billing/preparing-iab-app.html (here it says to look at Trivial Drive) – user8251758 Jul 04 '17 at 17:33
  • 1
    The first and third link where it says to use the aidl file reflects how to integrate when In App Billing v3 was released (2013). Since then Android Studio and gradle build system has become official. If you are starting a new project/app, I would follow the example of Trivial Drive v2. The aidl reference would be for supporting legacy apps. – Morrison Chang Jul 04 '17 at 17:55
  • So the "new Version 3 API" is not actually new at this point (https://developer.android.com/google/play/billing/index.html), and there's something else that's newer I should be using? I am so confused which links I should be using here. – user8251758 Jul 04 '17 at 17:57
  • The dp-1 library puts IAB V3 as the *minimum level*. Given how old it is, if you are starting fresh I would start there. – Morrison Chang Jul 04 '17 at 18:06
  • I am starting fresh, but I am not sure where "there" is -- I can't tell which pieces are old and which are new. – user8251758 Jul 04 '17 at 18:10
  • It sound like you are really new to Android. Adding libraries and dealing with versioning is normal (as well dealing with not necessarily consistent documentation). I would argue that using the gradle import is more in line with current standard, and where you read documentation regarding aidl to skip that part as the gradle import handles all of that stuff and focus on the Java In-App Billing API code. – Morrison Chang Jul 04 '17 at 18:48
2

TrivialDrive_v2 demonstrates a new way of integration with Google Play Billing.

It's based on the latest release of Play Billing library (currently 1.0) and tries to promote the best practices of integration with it.

TrivialDrive sample was kept for those that still use an integration via AIDL file (e.g. C++ developers).

goRGon
  • 4,402
  • 2
  • 43
  • 45
1

Trivial Drive V2 is refreshed sample for new release of Google Play Billing Library. See that link: https://android-developers.googleblog.com/2017/06/money-made-easily-with-new-google-play.html

Andrew Glukhoff
  • 898
  • 11
  • 9