-
- All Implemented Interfaces:
-
java.io.Serializable,org.acra.config.Configuration
public final class CoreConfiguration implements Serializable, Configuration
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description CoreConfiguration(String sharedPreferencesName, Boolean includeDropBoxSystemTags, List<String> additionalDropBoxTags, Integer dropboxCollectionMinutes, List<String> logcatArguments, List<ReportField> reportContent, Boolean deleteUnapprovedReportsOnApplicationStart, Boolean alsoReportToAndroidFramework, List<String> additionalSharedPreferences, Boolean logcatFilterByPid, Boolean logcatReadNonBlocking, Boolean sendReportsInDevMode, List<String> excludeMatchingSharedPreferencesKeys, List<String> excludeMatchingSettingsKeys, Class<?> buildConfigClass, String applicationLogFile, Integer applicationLogFileLines, Directory applicationLogFileDir, Class<out RetryPolicy> retryPolicyClass, Boolean stopServicesOnCrash, List<String> attachmentUris, Class<out AttachmentUriProvider> attachmentUriProvider, String reportSendSuccessToast, String reportSendFailureToast, StringFormat reportFormat, Boolean parallel, PluginLoader pluginLoader, List<Configuration> pluginConfigurations)
-
Method Summary
Modifier and Type Method Description final StringgetSharedPreferencesName()Name of the SharedPreferences that will host ACRA settings which you can make accessible to your users through a preferences screen:Default is to use the application default SharedPreferences, as retrieved with android.preference.PreferenceManager.getDefaultSharedPreferences final BooleangetIncludeDropBoxSystemTags()If enabled, DropBox events collection will include system tags: system_app_anr
system_app_wtf
system_app_crash
system_server_anr
system_server_wtf
system_server_crash
BATTERY_DISCHARGE_INFO
SYSTEM_RECOVERY_LOG
SYSTEM_BOOT
SYSTEM_LAST_KMSG
APANIC_CONSOLE
APANIC_THREADS
SYSTEM_RESTART
SYSTEM_TOMBSTONE
data_app_strictmode
final List<String>getAdditionalDropBoxTags()Custom tags to be included in DropBox event collection final IntegergetDropboxCollectionMinutes()DropBox event collection will look back this many minutes final List<String>getLogcatArguments()Arguments to be passed to the logcat command line. final List<ReportField>getReportContent()Redefines the list of ReportFields collected and sent in your reports. final BooleangetDeleteUnapprovedReportsOnApplicationStart()Controls whether unapproved reports are deleted on application start or not. final BooleangetAlsoReportToAndroidFramework()Set this to true if you prefer displaying the native force close dialog after ACRA is done. final List<String>getAdditionalSharedPreferences()Add here your android.content.SharedPreferences identifier Strings if you use others than your application's default. final BooleangetLogcatFilterByPid()Set this to true if you want to include only logcat lines related to your Application process. final BooleangetLogcatReadNonBlocking()Set this to true if you want to read logcat lines in a non blocking way for your thread. final BooleangetSendReportsInDevMode()Set this to false if you want to disable sending reports in development mode. final List<String>getExcludeMatchingSharedPreferencesKeys()Provide here regex patterns to be evaluated on each android.content.SharedPreferences key to exclude KV pairs from the collected SharedPreferences. final List<String>getExcludeMatchingSettingsKeys()Provide here regex patterns to be evaluated on each [android.provider.Settings. final Class<?>getBuildConfigClass()The default value will be a BuildConfig class residing in the same package as the Application class. final StringgetApplicationLogFile()To use in combination with ReportField.APPLICATION_LOG to set the path/name of your application log file. final IntegergetApplicationLogFileLines()To use in combination with ReportField.APPLICATION_LOG to set the number of latest lines of your application log file to be collected. final DirectorygetApplicationLogFileDir()To use in combination with ReportField.APPLICATION_LOG to set the root for the path provided in applicationLogFile final Class<out RetryPolicy>getRetryPolicyClass()Implement a custom RetryPolicy to decide if a failed report should be resent or not. final BooleangetStopServicesOnCrash()If you have services which might crash on startup android will try to restart them indefinitely. final List<String>getAttachmentUris()Allows to attach files to crash reports. final Class<out AttachmentUriProvider>getAttachmentUriProvider()Allows attachmentUris configuration at runtime instead of compile time. final StringgetReportSendSuccessToast()Toast shown when a report is sent successfully final StringgetReportSendFailureToast()Toast shown when report sending fails final StringFormatgetReportFormat()Format in which the report should be sent final BooleangetParallel()Allow parallel collection. final PluginLoadergetPluginLoader()Allows custom plugin loading final List<Configuration>getPluginConfigurations()Plugin configurations Booleanenabled()checks if the corresponding plugin is enabled -
-
Constructor Detail
-
CoreConfiguration
CoreConfiguration(String sharedPreferencesName, Boolean includeDropBoxSystemTags, List<String> additionalDropBoxTags, Integer dropboxCollectionMinutes, List<String> logcatArguments, List<ReportField> reportContent, Boolean deleteUnapprovedReportsOnApplicationStart, Boolean alsoReportToAndroidFramework, List<String> additionalSharedPreferences, Boolean logcatFilterByPid, Boolean logcatReadNonBlocking, Boolean sendReportsInDevMode, List<String> excludeMatchingSharedPreferencesKeys, List<String> excludeMatchingSettingsKeys, Class<?> buildConfigClass, String applicationLogFile, Integer applicationLogFileLines, Directory applicationLogFileDir, Class<out RetryPolicy> retryPolicyClass, Boolean stopServicesOnCrash, List<String> attachmentUris, Class<out AttachmentUriProvider> attachmentUriProvider, String reportSendSuccessToast, String reportSendFailureToast, StringFormat reportFormat, Boolean parallel, PluginLoader pluginLoader, List<Configuration> pluginConfigurations)
-
-
Method Detail
-
getSharedPreferencesName
final String getSharedPreferencesName()
Name of the SharedPreferences that will host ACRA settings which you can make accessible to your users through a preferences screen:
Default is to use the application default SharedPreferences, as retrieved with android.preference.PreferenceManager.getDefaultSharedPreferences
-
getIncludeDropBoxSystemTags
final Boolean getIncludeDropBoxSystemTags()
If enabled, DropBox events collection will include system tags:
system_app_anr
system_app_wtf
system_app_crash
system_server_anr
system_server_wtf
system_server_crash
BATTERY_DISCHARGE_INFO
SYSTEM_RECOVERY_LOG
SYSTEM_BOOT
SYSTEM_LAST_KMSG
APANIC_CONSOLE
APANIC_THREADS
SYSTEM_RESTART
SYSTEM_TOMBSTONE
data_app_strictmode
-
getAdditionalDropBoxTags
final List<String> getAdditionalDropBoxTags()
Custom tags to be included in DropBox event collection
-
getDropboxCollectionMinutes
final Integer getDropboxCollectionMinutes()
DropBox event collection will look back this many minutes
-
getLogcatArguments
final List<String> getLogcatArguments()
Arguments to be passed to the logcat command line.
Do not include -b arguments for buffer selection, include ReportField.EVENTSLOG and ReportField.RADIOLOG in reportContent to activate alternative logcat buffers reporting. They will use the same other arguments as those provided here.
-
getReportContent
final List<ReportField> getReportContent()
Redefines the list of ReportFields collected and sent in your reports.
You can also use this property to modify fields order in your reports.
-
getDeleteUnapprovedReportsOnApplicationStart
final Boolean getDeleteUnapprovedReportsOnApplicationStart()
Controls whether unapproved reports are deleted on application start or not.
<p> Silent and Toast reports are automatically approved. Dialog and Notification reports require explicit approval by the user before they are sent. </p> <p> On application restart the user is prompted with approval for one unsent report. So you generally don't want to accumulate unapproved reports, otherwise you will prompt them multiple times. </p> <p> If this is set to true then all unapproved reports bar one will be deleted on application start. The last report is always retained because that is the report that probably just happened. </p>
-
getAlsoReportToAndroidFramework
final Boolean getAlsoReportToAndroidFramework()
Set this to true if you prefer displaying the native force close dialog after ACRA is done. Recommended: Keep this set to false if using interactions with user input.
-
getAdditionalSharedPreferences
final List<String> getAdditionalSharedPreferences()
Add here your android.content.SharedPreferences identifier Strings if you use others than your application's default. They will be added to the ReportField.SHARED_PREFERENCES field.
-
getLogcatFilterByPid
final Boolean getLogcatFilterByPid()
Set this to true if you want to include only logcat lines related to your Application process. Note that this is always done by android starting with API 16 (Jellybean)
-
getLogcatReadNonBlocking
final Boolean getLogcatReadNonBlocking()
Set this to true if you want to read logcat lines in a non blocking way for your thread. It has a default timeout of 3 seconds.
-
getSendReportsInDevMode
final Boolean getSendReportsInDevMode()
Set this to false if you want to disable sending reports in development mode. Only signed application packages will send reports.
-
getExcludeMatchingSharedPreferencesKeys
final List<String> getExcludeMatchingSharedPreferencesKeys()
Provide here regex patterns to be evaluated on each android.content.SharedPreferences key to exclude KV pairs from the collected SharedPreferences. This allows you to exclude sensitive user data like passwords from being collected.
If you only want to include some keys, you may use regular expressions to do so:
<table summary="examples"> <tr><td>only keys foo and bar</td><td><pre>"^(?!foo|bar).*$"</pre></td></tr> <tr><td>only keys <i>containing</i> foo and bar</td><td><pre>"^((?!foo|bar).)*$"</pre></td></tr> </table>
-
getExcludeMatchingSettingsKeys
final List<String> getExcludeMatchingSettingsKeys()
Provide here regex patterns to be evaluated on each [android.provider.Settings.System}, android.provider.Settings.Secure and android.provider.Settings.Global key to exclude KV pairs from being collected. This allows you to exclude sensitive data from being collected.
If you only want to include some keys, you may use regular expressions to do so:
<table summary="examples"> <tr><td>only keys foo and bar</td><td><pre>"^(?!foo|bar).*$"</pre></td></tr> <tr><td>only keys <i>containing</i> foo and bar</td><td><pre>"^((?!foo|bar).)*$"</pre></td></tr> </table>
-
getBuildConfigClass
final Class<?> getBuildConfigClass()
The default value will be a BuildConfig class residing in the same package as the Application class. You only have to set this option if your BuildConfig class is obfuscated.
-
getApplicationLogFile
final String getApplicationLogFile()
To use in combination with ReportField.APPLICATION_LOG to set the path/name of your application log file.
-
getApplicationLogFileLines
final Integer getApplicationLogFileLines()
To use in combination with ReportField.APPLICATION_LOG to set the number of latest lines of your application log file to be collected. Default value is 100.
-
getApplicationLogFileDir
final Directory getApplicationLogFileDir()
To use in combination with ReportField.APPLICATION_LOG to set the root for the path provided in applicationLogFile
-
getRetryPolicyClass
final Class<out RetryPolicy> getRetryPolicyClass()
Implement a custom RetryPolicy to decide if a failed report should be resent or not.
-
getStopServicesOnCrash
final Boolean getStopServicesOnCrash()
If you have services which might crash on startup android will try to restart them indefinitely. Set this to true to prevent that.
-
getAttachmentUris
final List<String> getAttachmentUris()
Allows to attach files to crash reports.
<p> ACRA contains a file provider under the following Uri: <code>content://[applicationId].acra/[Directory]/[Path]</code> where <code>[applicationId]</code> is your application package name, <code>[Directory]</code> is one of the enum constants in [Directory] in lower case and <code>[Path]</code> is the relative path to the file in that directory e.g. content://org.acra.test.acra/files/thisIsATest.txt </p> Side effects:POST mode: requests will be sent with content-type multipart/form-data
PUT mode: There will be additional requests with the attachments. Naming scheme: <reportId>-<filename>
EMAIL mode: Some email clients do not support attachments, so some emails may lack these attachments. Note that attachments might be readable to email clients when they are sent.
-
getAttachmentUriProvider
final Class<out AttachmentUriProvider> getAttachmentUriProvider()
Allows attachmentUris configuration at runtime instead of compile time.
-
getReportSendSuccessToast
final String getReportSendSuccessToast()
Toast shown when a report is sent successfully
-
getReportSendFailureToast
final String getReportSendFailureToast()
Toast shown when report sending fails
-
getReportFormat
final StringFormat getReportFormat()
Format in which the report should be sent
-
getParallel
final Boolean getParallel()
Allow parallel collection. Increases performance but might pollute e.g. logcat output
-
getPluginLoader
final PluginLoader getPluginLoader()
Allows custom plugin loading
-
getPluginConfigurations
final List<Configuration> getPluginConfigurations()
Plugin configurations
-
-
-