Skip to content

Commit

Permalink
Merge pull request #347 from ACRA/acra-enable
Browse files Browse the repository at this point in the history
Don't send reports on startup unless ACRA has been enabled.
  • Loading branch information
william-ferguson-au committed Jan 5, 2016
2 parents 3e5f74b + 7309388 commit 13d3779
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/main/java/org/acra/ErrorReporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -509,12 +509,16 @@ public void setEnabled(boolean enabled) {
* If true then approve unapproved reports first.
*/
void startSendingReports(boolean onlySendSilentReports, boolean approveReportsFirst) {
ACRA.log.v(LOG_TAG, "About to start SenderService");
final Intent intent = new Intent(mContext, SenderService.class);
intent.putExtra(SenderService.EXTRA_ONLY_SEND_SILENT_REPORTS, onlySendSilentReports);
intent.putExtra(SenderService.EXTRA_APPROVE_REPORTS_FIRST, approveReportsFirst);
intent.putExtra(SenderService.EXTRA_REPORT_SENDER_FACTORIES, reportSenderFactories);
mContext.startService(intent);
if (enabled) {
ACRA.log.v(LOG_TAG, "About to start SenderService");
final Intent intent = new Intent(mContext, SenderService.class);
intent.putExtra(SenderService.EXTRA_ONLY_SEND_SILENT_REPORTS, onlySendSilentReports);
intent.putExtra(SenderService.EXTRA_APPROVE_REPORTS_FIRST, approveReportsFirst);
intent.putExtra(SenderService.EXTRA_REPORT_SENDER_FACTORIES, reportSenderFactories);
mContext.startService(intent);
} else {
ACRA.log.w(LOG_TAG, "Would be sending reports, but ACRA is disabled");
}
}

/**
Expand Down Expand Up @@ -670,8 +674,7 @@ public long getElapsedTime() {
}

/**
* Try to send a report, if an error occurs stores a report file for a later
* attempt.
* Try to send a report, if an error occurs stores a report file for a later attempt.
*
* @param reportBuilder The report builder used to assemble the report
*/
Expand Down

0 comments on commit 13d3779

Please sign in to comment.