Skip to content Skip to sidebar Skip to footer

Android Crashlytics Unset String

Crashlytics allows strings to be sent with crash logs, but how can they be unset? Let's say I working on a media player. Sometimes I want to send a non fatal log with a media id.

Solution 1:

You just need to pass null as a value in the arguments

Stringkey = "mediaId";
Crashlytics.setString(key, null);

There is check inside this method if value is null then it will set empty string:

publicvoidsetString(String key, String value) {
    // some code
    value = value == null ? "" : sanitizeAttribute(value);
    //some code
}

EDIT

The only way to this is reinitialize the crashlytics:

CrashlyticsCore core = new CrashlyticsCore.Builder().build();
Fabric.with(this, new Crashlytics.Builder().core(core).build());

Your kyes are stored inside CrashlyticsCore's map private final ConcurrentHashMap<String, String> attributes; and there is no possibility to get those values and remove some of your keys except init it in the Builder class.

Post a Comment for "Android Crashlytics Unset String"