Skip to content

Commit fa0e967

Browse files
committed
feat(messaging, android): support BigQuery export setting in firebase.json
the BigQuery export true/false toggle was exposed as a programmatic API before, but there is also an AndroidManifest.xml setting we may expose via firebase.json
1 parent 66ef77d commit fa0e967

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

packages/app/firebase-schema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@
104104
"description": "On Android, any message which displays a Notification use a default Notification Channel (created by FCM called `Miscellaneous`). This channel contains basic notification settings which may not be appropriate for your application. You can change what Channel is used by updating the `messaging_android_notification_channel_id` property.",
105105
"type": "string"
106106
},
107+
"messaging_android_notification_delivery_metrics_export_enabled": {
108+
"description": "Determines whether Firebase Cloud Messaging exports message delivery metrics to BigQuery. Defaults to disabled.",
109+
"type": "boolean"
110+
},
107111
"messaging_android_notification_color": {
108112
"description": "On Android, any messages which display a Notification do not use a color to tint the content (such as the small icon, title etc). To provide a custom tint color, update the messaging_android_notification_color property with a Android color resource name. \n The library provides a set of predefined colors corresponding to the HTML colors for convenience",
109113
"type": "string"

packages/messaging/android/build.gradle

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,13 @@ project.ext {
6161

6262
apply from: file('./../../app/android/firebase-json.gradle')
6363

64-
String notificationChannelId = ''
64+
String defaultNotificationChannelId = ''
65+
String notificationChannelId = defaultNotificationChannelId
6566
String defaultNotificationColor = '@color/white'
6667
String notificationColor = defaultNotificationColor
6768

69+
String deliveryMetricsExportEnabled = 'false'
70+
6871
// If nothing is defined, data collection defaults to true
6972
String dataCollectionEnabled = 'true'
7073

@@ -84,7 +87,10 @@ if (rootProject.ext && rootProject.ext.firebaseJson) {
8487
}
8588
}
8689

87-
notificationChannelId = rnfbConfig.getStringValue('messaging_android_notification_channel_id', '')
90+
if (rnfbConfig.isFlagEnabled('messaging_android_notification_delivery_metrics_export_enabled', false)) {
91+
deliveryMetricsExportEnabled = 'true'
92+
}
93+
notificationChannelId = rnfbConfig.getStringValue('messaging_android_notification_channel_id', defaultNotificationChannelId)
8894
notificationColor = rnfbConfig.getStringValue('messaging_android_notification_color', defaultNotificationColor)
8995
}
9096

@@ -97,6 +103,7 @@ android {
97103
defaultConfig {
98104
multiDexEnabled true
99105
manifestPlaceholders = [
106+
firebaseJsonDeliveryMetricsExportEnabled: deliveryMetricsExportEnabled,
100107
firebaseJsonAutoInitEnabled: dataCollectionEnabled,
101108
firebaseJsonNotificationChannelId: notificationChannelId,
102109
firebaseJsonNotificationColor: notificationColor

packages/messaging/android/src/main/AndroidManifest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
</intent-filter>
2525
</receiver>
2626

27+
<meta-data
28+
android:name= "delivery_metrics_exported_to_big_query_enabled"
29+
android:value="${firebaseJsonDeliveryMetricsExportEnabled}"/>
2730
<meta-data
2831
android:name="firebase_messaging_auto_init_enabled"
2932
android:value="${firebaseJsonAutoInitEnabled}"/>

tests/firebase.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
"messaging_auto_init_enabled": false,
1818
"messaging_android_headless_task_timeout": 30000,
19+
"messaging_android_notification_delivery_metrics_export_enabled": true,
1920
"messaging_android_notification_channel_id": "",
2021
"messaging_android_notification_color": "@color/hotpink",
2122
"messaging_ios_auto_register_for_remote_messages": false,

0 commit comments

Comments
 (0)