10

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?

Amit Tiwari
  • 3,684
  • 6
  • 33
  • 75

4 Answers4

8

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).

Rafal Zawadzki
  • 963
  • 6
  • 15
2

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.

Sandro Machado
  • 9,921
  • 4
  • 36
  • 57
  • 2
    maybe they changed the UI, there is no "more details", only a "View all sessions", still there is no user identifier... – cn123h Aug 09 '17 at 19:40
  • 1
    After you do "View all sessions", below "Device Statistics", you get the information of user in a small box. – Yesha Jan 08 '18 at 10:42
1

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

Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
Arul Pandian
  • 1,685
  • 15
  • 20
  • can you please explain that? In Firebase Crashlytics setting of empty user id will remove id from report afaik. How can user email be received (as in your screenshot)? – 4ntoine May 11 '20 at 18:50
0

enter image description here

If you look into codes of FirebaseCrashlytics than you can see that userId is being saved into the session. So I am sure that after restarting application your id will be restored.

Axbor Axrorov
  • 2,720
  • 2
  • 17
  • 35