The missing piece in integrating RevenueCat, Firebase, and Flutter
💡 Update: Firebase Analytics' Flutter plugin now exposes firebaseAppInstanceId
. PR here.
RevenueCat's latest integration with Firebase significantly improved their already invaluable service.
We use both services in Clearful, and this integration immediately gave us several key benefits:
More granular subscription events to be used in our A/B testing.
Querying subscription data became faster and more accessible.
It allowed us to more easily create subscription lifecycle events such as a free trial ending push notification, among others.
When following the integration documentation, however, I learned that the firebaseAppInstanceId
property hasn't yet been exposed by the Firebase team in the Flutter/Firebase Analytics plugin.
I briefly considered writing a Flutter plugin myself to grab the firebaseAppInstanceId
from Firebase Analytics' iOS and Android plugins, but thankfully common sense prevailed, and I first decided to search and see if anyone else had already done this. And voila! Enter firebase_instance_id - a simple plugin that does precisely what I needed and nothing else.
Once I found this plugin, setting firebaseAppInstanceId
as a subscriber attribute in RevenueCat was simple: