Home » Android » android – Get user information in Crashlytics

android – Get user information in Crashlytics

Posted by: admin June 15, 2020 Leave a comment

Questions:

I am using Crashlytics in my application and I wanted to get user id and email along with each crash. I did something like this:

Crashlytics.setUserEmail(tokenModel.getEmail());
Crashlytics.setUserIdentifier(String.valueOf(tokenModel.getPk()));

I am doing this in my login screen, after the user has provided his email and successfully registered with the app, so as to get user id. The problem is, I am not getting these data in the crash reports.

What is the lifecycle and working of Crashlytics in above context? Do I need to set these fields every time the app opens?

How to&Answers:

I am not sure if it needs to be done every time you launch the app and the Crashlytics docs don’t explicitly say it neither.

I know that we do it with every launch and it works – provided user info is displayed properly in the dashboard.

My suggestion would be to try send this information every time you initalize Crashlytics with Fabric.with(this, new Crashlytics());, as soon as you have your user data provided (for example after fetching his user profile from your server).

Answer:

You need to select the issue, click in more details and at the top right corner you can see a label with Identifier.

You need to set it every time you initialise the Crashlytics. At least doing this it works.

Answer:

if you are using this Crashlytics.setUserIdentifier(""); you can check in data tab in firebase. Fabric.with(this, new Crashlytics()); working fine.

enter image description here