Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clear/remove firebase Crashlytics custom keys?

Tags:

crashlytics

You can associate arbitrary key/value pairs with your crash reports by FirebaseCrashlytics.getInstance().setCustomKey(key, value)

Fine.
But how can I revert those when I don't need anymore?

Consider following code:

// report 'ex_1' with "info" key
FirebaseCrashlytics.getInstance().setCustomKey("info", "abc");
FirebaseCrashlytics.getInstance().recordException(ex_1);

//Now I want to clear custom keys, so I want to report 'ex_2' without "info"
//FirebaseCrashlytics.getInstance().REMOVECustomKey("info");
FirebaseCrashlytics.getInstance().recordException(ex_2);
like image 874
Zoli Avatar asked Feb 01 '21 13:02

Zoli


People also ask

Where are Firebase Crashlytics logs?

Once you have Crashlytics up and running in your app, you can navigate to Crashlytics in your Firebase Console underneath 'Quality' and start reviewing the reports as they come in. If this page still tells you to setup, build or run your app then you have not correctly setup Crashlytics in your app (see Usage).

How do I access Crashlytics logs?

Crashlytics associates the logs with your crash data and displays them in the Crashlytics page of the Firebase console, under the Logs tab.


1 Answers

I don't see anything in the SDK that allows for this. They should really offer some way to clear the Custom Keys but the SDK does not allow for nullable values either.

The way I went around it was just to override the one-shot custom keys with a 0.

// Set key
FirebaseCrashlytics.getInstance().setCustomKey("key", "value")

// Clear key
FirebaseCrashlytics.getInstance().setCustomKey("key", 0)

It is not the cleanest approach but at least you know those values got reset.

like image 123
Dhananjay Suresh Avatar answered Oct 19 '22 21:10

Dhananjay Suresh