blonsky95 / TimeStopperAndroid

0 stars 0 forks source link

Actually implement the billing stuff #26

Closed blonsky95 closed 3 years ago

blonsky95 commented 3 years ago

Following these steps
https://developer.android.com/google/play/billing/integrate#kotlin

blonsky95 commented 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

blonsky95 commented 3 years ago

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

blonsky95 commented 3 years ago

Test if billing client lifecycle works fine

blonsky95 commented 3 years ago

most things working now

do some clean up

blonsky95 commented 3 years ago

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)

lol https://kotlinlang.org/docs/reference/interfaces.html

blonsky95 commented 3 years ago
blonsky95 commented 3 years ago

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)

blonsky95 commented 3 years ago

THINGS TO DO:

  1. 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 -

  2. 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

blonsky95 commented 3 years ago

So right now it works well, still need to address points 1. and 4. from previous comment but

blonsky95 commented 3 years ago

test the following

start free trial with internet (3 min) - then cancel before renewing - then take internet - then use app

blonsky95 commented 3 years ago

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!!!

blonsky95 commented 3 years ago

So now go to dev guides and test the other scenarios

then clean up strings and text

blonsky95 commented 3 years ago

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

blonsky95 commented 3 years ago
blonsky95 commented 3 years ago

STRINGS DONE - now think basic scenarios - release it and test it or something - see whats next