I'm getting an error in crashlytics logs
java.lang.RuntimeException: Error receiving broadcast Intent { act=com.android.vending.billing.PURCHASES_UPDATED flg=0x10 pkg=*** (has extras) } in com.android.billingclient.api.zzg@c300e4d android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1577) android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(Unknown Source:2) android.os.Handler.handleCallback(Handler.java:938) android.os.Handler.dispatchMessage(Handler.java:99) android.os.Looper.loop(Looper.java:368) android.app.ActivityThread.main(ActivityThread.java:7710) java.lang.reflect.Method.invoke(Native Method) com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
Using standard Google billing library subscriptions + in-app billing
https://developer.android.com/google/play/billing/integrate
I don't see in docs that I should register broadcast receiver, where PURCHASES_UPDATED
come from?
The issue was an architectural issue, the billing client was initialized in some base Activity
in onCreate
, and there was a situation when purchase callback was triggered in few activities, and one of them was in illegal state.