android / play-billing-samples

Samples for Google Play In-app Billing
Apache License 2.0
2.38k stars 1.34k forks source link

Samples are completely different from the documentation #476

Open itsandreramon opened 3 years ago

itsandreramon commented 3 years ago

The documentation uses the Classy Taxi sample. Yet, I cannot find the code in the folder of this repo:

https://developer.android.com/google/play/billing/integrate

Am I missing something? Why is the sample code so complex?

blundell commented 3 years ago

the first code snippet in the documentation you link is this:

image

That code is here: https://github.com/android/play-billing-samples/blob/main/ClassyTaxiAppKotlin/app/src/main/java/com/example/subscriptions/billing/BillingClientLifecycle.kt#L89-L92

Unfortunately with a feature as complicated as in app purchase (which has at least 3 actors Your App, Google Play & Your Server) the examples in the documentation will not match a real world example.

The sample code is trying to account for the complexities of communication between 3 actors, as well as the tumultuous nature of mobile (read: Android) application development.

The sample app, takes in to consideration syncing, errors, duplicates, threading etc etc that the documentation does not.

My only recommendation would be to follow the documentation and implement each step as it explain it. Once finished delete all of that and start again by checking out the sample app and reading through how it does each step that you just learnt. Finally implementing In App Purchase yourself (to match your usecase) taking the best bits you have gleamed from a combination of the documentation and sample app.

Hope that helps!

LordByron1788 commented 2 years ago

Unfortunately with a feature as complicated as in app purchase (which has at least 3 actors Your App, Google Play & Your Server) the examples in the documentation will not match a real world example.

Sorry, but this points to a fundamental problem with Billing on Android which was a problem created by Google. What exactly is Google doing about it?

The sample code is trying to account for the complexities of communication between 3 actors, as well as the tumultuous nature of mobile (read: Android) application development.

Then both your sample and documentation produced by the Google Android Team is inadequate.

Stop blaming developers and asking them to put up with this nonsense.

solodon4 commented 7 months ago

Google isn't playing by their own rules: they force everyone onto 2 year version update cycle, yet with their endless money flow they themselves don't have enough resources to keep their samples updated accordingly. I bet these samples don't even have owners inside Google!

Hey, Google! Care to prove me wrong?