How do I clear out my data on app signout from crashlytics
Asked Answered
B

1

6

I am using fabric/crashlytics for log reporting. I am usually setting username, email,id etc once a user signs into my app. I was wondering if there is a way I can clear out my user data on app signout. I tried looking for a way /function to clear data on crashlytics but no luck. Any ideas?

Currently I am setting username, email etc on my user profile page once a user signs in:

CrashlyticsCore.getInstance().setUserEmail(it.email)
                        CrashlyticsCore.getInstance().setUserName(it.firstName)
                        CrashlyticsCore.getInstance().setUserIdentifier(it.username)

and also once the app is launched I set this in my "application" class :

Fabric.with(this, CrashlyticsCore())

I want to keep the crashlytics running for the app but the user specific data cleared out upon logout. do I simply set it to null such that?

CrashlyticsCore.getInstance().setUserIdentifier(null) etc., 

or is there some clearuser data param I can use in my logout function?

Belly answered 11/12, 2018 at 11:28 Comment(11)
Have you checked this?Alleviation
I did but didnt provide any userful info. In one of my classes where I am pulling the profile. I am setting the username/identifier etc for crashlytics. Upon logout how do I clean out these values or data?Belly
I updated my question in the hopes it will give clearer explanationBelly
I think this CrashlyticsCore.getInstance().setUserIdentifier(null) should be worked.Alleviation
should i also clearout logexception or thats not necessary? CrashlyticsCore.getInstance.logexception(null)Belly
No. That's not necessary.Alleviation
also are you sure settng to null is a good idea and will clear out the data?Belly
I don't think so. But as i know if we save our data in Shared preference and we want to clear data on logout then we can set empty value for that particular key. You can check does it works or not?. If we get good recommend way then we can implement that !Alleviation
After using CrashlyticsCore.getInstance().setUserIdentifier(null) did it work?Alleviation
Ideally it is supposed to, but haven't tried. You never get any crashes when you need. do you happen to know if this 100% works or if theres a better solutionBelly
What did the work ?Alleviation
A
3

You should refer to the Firebase documentation for Crashlytics, as it is currently merged with Google's Firebase while the SDK has been left unchanged. This specific functionality is documented here.

If you ever need to clear a user identifier after you set it, reset the value to a blank string. Clearing a user identifier does not remove existing Crashlytics records. If you need to delete records associated with a user ID, contact Firebase support.

So you shall set the user identifiers to the empty string, to avoid new crash reports to contain the previously logged user data. Existing ones cannot be modified.

Albeit answered 13/12, 2018 at 17:30 Comment(2)
empty strings as in CrashlyticsCore.getInstance().setUserEmail(String.EMPTY)? or null will sufficeBelly
Reading the description I understand CrashlyticsCore.getInstance().setUserEmail("")Albeit

© 2022 - 2024 — McMap. All rights reserved.