I am caching my users purchases locally using Room. For this, I created an insert function, which is suspending.
First, in my repository, I called the insert function from a function called launchBillingFlow which is suspending and its signature looks like this:
suspend fun launchBillingFlow(activity, skuDetails)
I have had no errors doing it like this. Afterwards, I created a private function for acknowledging the purchase and moved the insert call to there. It's signature looks like this:
private suspend fun acknowledgePurchase(purchase)
But when I call the insert function from there, I get following error:
Suspension functions can be called only within coroutine body
And I don't understand why this is. I call launchBillingFlow from a coroutine body and it calls acknowledgePurchase. And I am doing a similar thing with querying the SkuDetails, too. Is this a lint bug or am I missing something?