Recently I integrated Firebase’s Crashlytics solution into one of our main Android products. It’s fairly easy to integrate, just 4 steps as per Crashlytics’s documentation here. But as with any reporting system there involves the issue of privacy and data collection problem. Always important to inform the user if you are collecting any information and also request for their consent to do so. By default Crashlytics’s behavior is to start reporting on every crash. So instead if you want to setup an opt-in process then all you have to do is
In your AndroidManifest.xml, add this
<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="false" />
In your app’s main Activity file, in the onCreate method add this
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// toggle Crashlytics on/off based on user consent
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
boolean enableCrashReporting = preferences.getBoolean("enable_crash_report", false);
if(enableCrashReporting) {
Fabric.with(this, new Crashlytics());
}
}
✍ Comments