capacitor-community / fcm

Enable Firebase Cloud Messaging for Capacitor apps
https://capacitor.ionicframework.com/docs/
MIT License
238 stars 83 forks source link

Enable Firebase Message Delivery Data Export to BigQuery #156

Open githubjakob opened 2 months ago

githubjakob commented 2 months ago

Is your feature request related to a problem? Please describe. FCM provides tools to gain insights into push notification message delivery. One such tool is the BigQuery data export. The MESSAGE_DELIVERED event is not available by default, but needs to be enabled on the app level. It would be nice to enable it via the Capacitor FCM plugin.

Describe the solution you'd like Ideally the capacitor plugin provides a interface to enable the MESSAGE_DELIVERED metric being exported to BigQuery, similar to setDeliveryMetricsExportToBigQuery(true). So that I can set it enabled during app runtime after the user provided consent to export the data.

Describe alternatives you've considered I tried to follow the instructions given here https://firebase.google.com/docs/cloud-messaging/understand-delivery?platform=android#enable-message-delivery-data-export

For Android at least the global setting in the app manifest is straightforward, but I cannot figure out how to combine using the Capacitor FCM plugin with the native iOS and Android code snippets given in the Firebase docs.

Additional context I'm open to provide a PR if I can figure out how to do it.

If somebody who already is using the feature could give my some pointers, I would by glad!

In particular, for iOS: When I create the NotificationServiceExtension as suggested by the docs, I don't receive events in the didReceive callback handler, even when mutable-content is set to 1 in the message.