androidcrash-reportscrashlyticscrashlytics-android

How to set user information to Crashlytics api in Android


I am trying to set user information to crash reports in crashlytics in Android App, so that it will help me to find out which of our users experienced a given crash. I have explored and found there are 3 APIs can set user information in crash report.

Those are,

void Crashlytics.setUserIdentifier(String identifier);

void Crashlytics.setUserName(String name);

void Crashlytics.setUserEmail(String email);

It is recommended to use all the APIs. All documented at http://support.crashlytics.com/knowledgebase/articles/120548-how-do-i-set-user-information-

But I have no idea, 1. How to get user-identifier, name and email details, which are input to those APIs? 2. Which place in program to call these crashlytics APIs?

Please share some ideas, how to implement this.

Regards

Annada


Solution

  • If your application uses some form of user identification (i.e. login, email, phone, device specific id) you can use that as crashlitics user information. I suppose you can generate user id when your app is first launched and save it in shared preferences, for example. It'll be shown at top-right corner of detailed crash view.

    i.e. I set ID and name as soon as user authenticates in my app.

    enter image description here

    You typically want to set them as soon as possible (as your data arrives) and all info has been initialized.