Skip to content

Commit 84ab316

Browse files
authored
Nudge customers to update if on an old Firebase Analytics (#1349)
* Nudge customers to update if on an old Firebase Analytics We can infer the customer is on an outdated version of FA if we cannot attach a listener with the "clx" origin. If that is the case, use the old "crash" origin and write a logcat warning with a nudge to upgrade. * Minor logging output improvements
1 parent 844646e commit 84ab316

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

firebase-crashlytics/src/main/java/com/google/firebase/crashlytics/internal/analytics/AnalyticsConnectorReceiver.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public interface BreadcrumbHandler {
3131
}
3232

3333
static final String CRASHLYTICS_ORIGIN = "clx";
34+
static final String LEGACY_CRASH_ORIGIN = "crash";
3435
public static final String EVENT_NAME_KEY = "name";
3536
public static final String APP_EXCEPTION_EVENT_NAME = "_ae";
3637
private static final String EVENT_ORIGIN_KEY = "_o";
@@ -66,6 +67,25 @@ public boolean register() {
6667
analyticsConnectorHandle =
6768
analyticsConnector.registerAnalyticsConnectorListener(CRASHLYTICS_ORIGIN, this);
6869

70+
if (analyticsConnectorHandle == null) {
71+
Logger.getLogger()
72+
.d("Could not register AnalyticsConnectorListener with Crashlytics origin.");
73+
// Older versions of FA don't support CRASHLYTICS_ORIGIN. We can try using the old Firebase
74+
// Crash Reporting origin
75+
analyticsConnectorHandle =
76+
analyticsConnector.registerAnalyticsConnectorListener(LEGACY_CRASH_ORIGIN, this);
77+
78+
// If FA allows us to connect with the legacy origin, but not the new one, nudge customers
79+
// to update their FA version.
80+
if (analyticsConnectorHandle != null) {
81+
Logger.getLogger()
82+
.w(
83+
"A new version of the Google Analytics for Firebase SDK is now available. "
84+
+ "For improved performance and compatibility with Crashlytics, please "
85+
+ "update to the latest version.");
86+
}
87+
}
88+
6989
return analyticsConnectorHandle != null;
7090
}
7191

0 commit comments

Comments
 (0)