How to disable Crashlytics at runtime in response to a change in user preferences?

I would like to specify a setting in my settings for the Android application settings that allows the user to disable our use of analytical software, including Crashlytics. However, Crashlytics.start(Context) is called long before the user gets to the settings page, and I do not see the equivalent Crashlytics.stop(Context) function. Is it possible to stop Crashlytics in an application after launching it?

+8
android crashlytics
source share
2 answers

I was informed that the specific case that I am trying to do is currently impossible. However, I can give users the ability to control the sending of data to Crashlytics by turning on "Privacy" in the application settings section of the Crashlytics dashboard:

Go here to select the application you want to add in the dialog box and click "Enable Account" in the upper left corner.

from: http://support.crashlytics.com/knowledgebase/articles/349914-can-i-toggle-whether-or-not-a-user-needs-to-give-p

+2
source share

It is easy to do.

  • Add preference to the settings of your application and let the user know if he wants to do this or not.
  • Throw an UncaughtExceptionHandler and do it

@Override public void uncaughtException(Thread thread, Throwable ex) { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(MyApplication.getAppContext()); Boolean send = sharedPref.getBoolean(MySettingsActivity.KEY_PREF_SEND_ERROR, true); if (send) { orgHandler.uncaughtException(thread, ex); } else System.exit(0); }

+1
source share

All Articles