FirebaseCrashlytics setUserId - Should we need set it on every app launch

Viewed 538

For FirebaseCrashlytics i am setting the user id once user logged in then store its credentials in sharedpreference.

FirebaseCrashlytics.getInstance().setUserId("12345");

On next App launch User will be automatically logged in. So Should I set user id on every app launch or its the one time function call. What should I do in case on user logged out and switch to another account on same device

1 Answers

You will have to implement a method to associate User ID's with devices/users. You can do something like this UUID uuid = UUID.randomUUID();, to associate randomized UUID's to the setUserId method. You can read more about this here https://www.baeldung.com/java-uuid.

Depending on your method, you can log certain identifiable information based on how your user logs into your app. Such as via email or something, but that's discouraged for privacy reasons.

Related