How do I use custom keys?

This page is now deprecated. For the latest version, please click here.

At times, even full stack traces with line numbers aren't quite enough to pinpoint the bug. To give you even more insight, Crashlytics provides 4 logging mechanisms right out of the box: LoggingCustom KeysUser Information, and Caught Exceptions.

Custom Keys

Context is king when debugging crashes, and knowing the values of critical variables in your app, such as the level of the game the user got to, how many friends they have, or the byte size of the last photo they took, might be critical in shaving hours off your debugging time. 

You're in luck - Crashlytics allows you to associate arbitrary key/value pairs with your crash reports, which are viewable right from the Crashlytics dashboard. Setting keys are as easy as calling: Crashlytics.setString(key, value) or one of the related methods.

Options are: 

void setBool(String key, boolean value); 
void setDouble(String key, double value); 
void setFloat(String key, float value); 
void setInt(String key, int value); 

Re-setting the same key will update the value. 


Crashlytics.setInt("current_level", 3);
Crashlytics.setString("last_UI_action", "logged_in");

Note: By default, Crashlytics currently supports a maximum of 64 key/value pairs. Once you reach this threshold, additional values are not saved. If you need more, please contact Support.

Feedback and Knowledge Base