I am trying to make a donation iap that unlocks different themes for the app. Because of that, I am trying to query if the donation SKU is purchased before setting the content view. Is that possible? I've tried this so far:

fun onCreate(savedInstanceState: Bundle?){
    billingRepository.isPurchased(SKU_COFFEE).observe(this){ premium: Boolean ->
        if(premium) setTheme(requestedTheme)
        _binding = ...

But this leads to ANRs when the phone doesn't have access to Internet.

(The billingRepository is the one that comes from the Trivial Drive sample made by Google.)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.