简体   繁体   中英

Custom keys in Crashlytics seems to be lost between activities

I wanted to add custom keys in Crashlytics reports so I done something like this:

Activity 1:

Crashlytics.start(this);

Activity 2:

Crashlytics.setString(Constants.MY_KEY, "my value");

... Crashlytics.setString(Constants.MY_KEY, "my overwritten value");

Activity 3:

Crashlytics.getInstance().crash();

The problem is that there is no MY_KEY displayed in the crash info. ONLY if I set it in Activity 1 but is not getting overwritten on Activity 2.

Is there any workaround to make this work ?

I don't see anything wrong with this approach. Just make sure your custom key in Activity 2 is read before crash happens. You can put a break point or log it to make sure the setString method is called.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM