2

I am trying to figure out how to link each and every crash with application user id. I got to know we can achieve this functionality with firebase customized key logs.

For POC purpose, I have added custom key after logged in completion and then I am crashing app on next screen. But Custom keys are not getting logged on console.

Here, how I am adding custom key :

FirebaseCrashlytics.getInstance().setCustomKey("userId", serverLoginResponse.getBody().getUserId());

And I am crashing application on next screen using divide by 0.

int i = 2;
int j = i / 0;

But keys are not gettging tagged to crash. Please see screenshots.

On Dashboard.
enter image description here

on Crash Details Screen :

enter image description here

Please let me know if I am doing anything wrong here.

Sandip Armal Patil
  • 6,241
  • 21
  • 93
  • 160

2 Answers2

2

You should enable the collection in your activity but preferable in the Main Application Class

FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true);

Follow this guide:

FirebaseCrashlytics

Shogun Nassar
  • 606
  • 7
  • 16
0

I noticed that key/values set using setCustomValue(_,_) didn't persist between app relaunches. I had to call the setCustomValue code everytime on app relaunch aka appDidFinishingWithOptions(_). See related solution and answer here: https://stackoverflow.com/a/68097562/4970749

Note that setCustomValue here affects Crashlytics dashboard which is the second screenshot you showed here, under "Crash Details Screen." It doesn't update Firebase Analytics keys/properties (first screenshot), thats a separate method (try: Analytics.setUserProperty(value, forName: name) for that first screenshot).

bubbaspike
  • 101
  • 6