Description
It seems that method register here performs a registerForActivityResult
call for foreground activity: https://github.com/NativeScript/firebase/blob/main/packages/firebase-messaging-core/index.android.ts#L62
There are cases that foreground activity is one that does not implement method registerForActivityResult
.
For instance, there was a recent report for payments
plugin that had an issue because of this.
That is because payments plugin uses an activity that extends android.app.Activity (found an example from fork of billing library): https://github.com/DimaDake/billing/blob/master/library/src/main/java/com/android/billingclient/api/ProxyBillingActivity.java
As a result, that activity became foregroundActivity
resulting in error described in issue NativeScript/payments#19. Foreground activity is used for register()
call here: https://github.com/NativeScript/firebase/blob/main/packages/firebase-messaging-core/index.android.ts#L274
I can see that register()
call was commented out in latest firebase version but we should be careful if we are going to use it again or already use it elsewhere: https://github.com/NativeScript/firebase/blob/main/packages/firebase-messaging-core/index.android.ts#L288
We probably have to use startActivity
specifically for this one, just to be sure we use an activity that supports registerForActivityResult
.