User can disable crash reporting.

This commit is contained in:
Pierre HUBERT 2018-08-06 15:20:18 +02:00
parent 84bc2f1fd4
commit 5d1d7fe5c3
3 changed files with 16 additions and 5 deletions

View File

@ -100,11 +100,13 @@ public class MainActivity extends AppCompatActivity implements
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//Initialize crash reporter
CrashReporter reporter = new CrashReporter(this, BuildConfig.crash_reporter_url,
BuildConfig.crash_reporter_key);
reporter.uploadAwaitingReport();
Thread.setDefaultUncaughtExceptionHandler(reporter);
//Initialize crash reporter (if enabled)
if(PreferencesUtils.getBoolean(this, "enable_crash_reporting", true)){
CrashReporter reporter = new CrashReporter(this, BuildConfig.crash_reporter_url,
BuildConfig.crash_reporter_key);
reporter.uploadAwaitingReport();
Thread.setDefaultUncaughtExceptionHandler(reporter);
}
//Initialize account objects
accountHelper = new AccountHelper(this);

View File

@ -209,4 +209,6 @@
<string name="notif_sent_group_membership_request">sent a request to join the group</string>
<string name="notif_accepted_group_membership_request">accepted your request to join the group</string>
<string name="notif_rejected_group_membership_request">rejected your request to join the group</string>
<string name="preference_crash_reporting_title">Send crash reports</string>
<string name="preference_crash_reporting_summary">Help us improve Comunic by sending anonymous reports when the application crash.</string>
</resources>

View File

@ -16,4 +16,11 @@
android:title="@string/preference_debug_mode_title"
android:summary="@string/preference_debug_mode_summary" />
<!-- Enable or disable crash reporting -->
<SwitchPreference
android:defaultValue="true"
android:key="enable_crash_reporting"
android:title="@string/preference_crash_reporting_title"
android:summary="@string/preference_crash_reporting_summary"/>
</PreferenceScreen>