diff --git a/packages/analytics/android/build.gradle b/packages/analytics/android/build.gradle
index 7e7e990bc3..407ca31609 100644
--- a/packages/analytics/android/build.gradle
+++ b/packages/analytics/android/build.gradle
@@ -63,9 +63,22 @@ project.ext {
])
}
+apply from: file("./../../app/android/firebase-json.gradle")
+
+def autoCollectionEnabled = "true"
+
+if (rootProject.ext && rootProject.ext.firebaseJson) {
+ if (rootProject.ext.firebaseJson.isFlagEnabled("analytics_auto_collection_enabled") == false) {
+ autoCollectionEnabled = "false"
+ }
+}
+
android {
defaultConfig {
multiDexEnabled true
+ manifestPlaceholders = [
+ firebaseJsonAutoCollectionEnabled: autoCollectionEnabled
+ ]
}
lintOptions {
disable 'GradleCompatible'
diff --git a/packages/analytics/android/src/main/AndroidManifest.xml b/packages/analytics/android/src/main/AndroidManifest.xml
index 7c57f03fd2..b3de893b46 100644
--- a/packages/analytics/android/src/main/AndroidManifest.xml
+++ b/packages/analytics/android/src/main/AndroidManifest.xml
@@ -5,4 +5,10 @@
+
+
+
+
diff --git a/packages/app/ios_config.sh b/packages/app/ios_config.sh
index 7a02b1291d..31c6f9d715 100755
--- a/packages/app/ios_config.sh
+++ b/packages/app/ios_config.sh
@@ -86,6 +86,14 @@ if [[ ${_SEARCH_RESULT} ]]; then
_PLIST_ENTRY_TYPES+=("string")
_PLIST_ENTRY_VALUES+=("$_JSON_OUTPUT_BASE64")
+ # config.analytics_auto_collection_enabled
+ _ANALYTICS_AUTO_COLLECTION=$(getFirebaseJsonKeyValue "$_JSON_OUTPUT_RAW" "analytics_auto_collection_enabled")
+ if [[ $_ANALYTICS_AUTO_COLLECTION ]]; then
+ _PLIST_ENTRY_KEYS+=("FIREBASE_ANALYTICS_COLLECTION_ENABLED")
+ _PLIST_ENTRY_TYPES+=("bool")
+ _PLIST_ENTRY_VALUES+=("$(jsonBoolToYesNo "$_ANALYTICS_AUTO_COLLECTION")")
+ fi
+
# config.messaging_auto_init_enabled
_MESSAGING_AUTO_INIT=$(getFirebaseJsonKeyValue "$_JSON_OUTPUT_RAW" "messaging_auto_init_enabled")
if [[ $_MESSAGING_AUTO_INIT ]]; then
diff --git a/tests/firebase.json b/tests/firebase.json
index e5d42e83e1..fd13dd68e3 100644
--- a/tests/firebase.json
+++ b/tests/firebase.json
@@ -15,7 +15,8 @@
"messaging_android_notification_color": "@color/hotpink",
"messaging_ios_auto_register_for_remote_messages": true,
- "TODO_analytics_auto_collection_enabled": true,
+ "analytics_auto_collection_enabled": true,
+
"TODO_perf_auto_collection_enabled": true,
"TODO_in_app_messaging_auto_collection_enabled": true,
"TODO_database_persistence_enabled": true,