Closed blonsky95 closed 3 years ago
interesting/helpful coroutine stuff about when to use withContext/await/async https://medium.com/@vcanato/withcontext-async-or-launch-inside-coroutine-kotlin-17c332854a08
This project also useful - example of implementing everything with billing https://github.com/android/play-billing-samples/blob/master/ClassyTaxiAppKotlin/app/src/main/java/com/example/subscriptions/billing/BillingClientLifecycle.kt
Test if billing client lifecycle works fine
most things working now
do some clean up
Just realised something big with interfaces
If you want something that inherits an interface to use all the methods, then the functions in the interface would be:
fun doSomething1()
if you inherit the interface, you have to provide a method for this
but if you do
fun doSomething1() {}
When you inherit the interface you dont have to provide a method, (the body exists even if empty so it doesnt need to be overriden)
need to follow this before I test purchasing
https://developer.android.com/google/play/billing/test#testing-purchases
see if what i have in code now can be tested with that - that when you press subscribe and it takes you to that skudetails i dont get the error of product not found
once that is working continue https://developer.android.com/google/play/billing/integrate#pending
bear in midn that i am acknowledging the purchase on main thread, see if its problem to block it or if it should be done elsewhere (coroutines)
THINGS TO DO:
If you uninstall and install or change device but same google account - user gets prompted - so option 1 - open billing client and do check at the start or option 2 - in the dialog for buying trigger another dialog saying the subscription is now active on this device - or just change button to ACTIVE - needs a how to cancel thing - non refundable -
change the subscribe button to something else when user finished subscribing or when they go to this screen if they already subscribed - use the live data in the query purchases function as well as the on purchase update
MOOOOOOOOOOOOOOOOOOOOOOOOD
So right now it works well, still need to address points 1. and 4. from previous comment but
test the following
start free trial with internet (3 min) - then cancel before renewing - then take internet - then use app
Ok good news - it seems like play store already does it behind the scenes and loads a cache version or something so even without internet, the billing client does receive the updated list of purchases in which the cancelled subscription doesn't show up, even when opening the app without internet, so it does it bts.
If I open the app without internet, with a valid subscription, it does work, and it appears in the list of purchases!!!
So now go to dev guides and test the other scenarios
then clean up strings and text
TESTS: https://developer.android.com/google/play/billing/test
see if after 6 months (6*30 mins) when it stopes renewing - if subscription status is removed - check at 5.23
Monthly subscription with grace period; user recovers - mid subscription change the test license to decline during a renewal,
test account holds - so - after a payment is declined it enters account hold where you dont have access but user should know the reason they dont have access if because payment didnt go through, so dont show normal subscribe dialog --- detect if account is on hold
Do all the text to make it have sense - in the dialog - and in the guide - add a section after controls about trial and premium
then think of the most basic scenarios and run them through
STRINGS DONE - now think basic scenarios - release it and test it or something - see whats next
Following these steps
https://developer.android.com/google/play/billing/integrate#kotlin