-
- All Implemented Interfaces:
-
com.bugsnag.android.CallbackAware,com.bugsnag.android.FeatureFlagAware,com.bugsnag.android.MetadataAware,com.bugsnag.android.UserAware
public class Configuration implements CallbackAware, MetadataAware, UserAware, FeatureFlagAwareUser-specified configuration storage object, contains information specified at the client level, api-key and endpoint configuration.
-
-
Constructor Summary
Constructors Constructor Description Configuration(String apiKey)Constructs a new Configuration object with default values.
-
Method Summary
Modifier and Type Method Description static Configurationload(@NonNull() Context context)Loads a Configuration object from values supplied as meta-data elements in yourAndroidManifest. StringgetApiKey()Retrieves the API key used for events sent to Bugsnag. voidsetApiKey(@NonNull() String apiKey)Changes the API key used for events sent to Bugsnag. StringgetAppVersion()Set the application version sent to Bugsnag. voidsetAppVersion(@Nullable() String appVersion)Set the application version sent to Bugsnag. IntegergetVersionCode()We'll automatically pull your versionCode from the versionCode fieldin your AndroidManifest.xml file. voidsetVersionCode(@Nullable() Integer versionCode)We'll automatically pull your versionCode from the versionCode fieldin your AndroidManifest.xml file. StringgetReleaseStage()If you would like to distinguish between errors that happen in different stages of theapplication release process (development, production, etc.) you can set the releaseStagethat is reported to Bugsnag. voidsetReleaseStage(@Nullable() String releaseStage)If you would like to distinguish between errors that happen in different stages of theapplication release process (development, production, etc.) you can set the releaseStagethat is reported to Bugsnag. ThreadSendPolicygetSendThreads()Controls whether we should capture and serialize the state of all threads at the timeof an error. voidsetSendThreads(@NonNull() ThreadSendPolicy sendThreads)Controls whether we should capture and serialize the state of all threads at the timeof an error. booleangetPersistUser()Set whether or not Bugsnag should persist user information between application sessions. voidsetPersistUser(boolean persistUser)Set whether Bugsnag should persist user information between application sessions. booleangetGenerateAnonymousId()Set whether Bugsnag should generate an anonymous ID and persist it in local storageIf disabled, any device ID that has been persisted will not be retrieved, and no newdevice ID will be generated or stored voidsetGenerateAnonymousId(boolean generateAnonymousId)Set whether Bugsnag should generate an anonymous ID and persist it in local storageIf disabled, any device ID that has been persisted will not be retrieved, and no newdevice ID will be generated or stored FilegetPersistenceDirectory()Sets the directory where event and session JSON payloads should be persisted if a networkrequest is not successful. voidsetPersistenceDirectory(@Nullable() File directory)Sets the directory where event and session JSON payloads should be persisted if a networkrequest is not successful. booleangetSendLaunchCrashesSynchronously()Sets whether Bugsnag should send crashes synchronously that occurred duringthe application's launch period. voidsetSendLaunchCrashesSynchronously(boolean sendLaunchCrashesSynchronously)Sets whether Bugsnag should send crashes synchronously that occurred duringthe application's launch period. longgetLaunchDurationMillis()Sets the threshold in milliseconds for an uncaught error to be considered as a crash onlaunch. voidsetLaunchDurationMillis(long launchDurationMillis)Sets the threshold in milliseconds for an uncaught error to be considered as a crash onlaunch. booleangetAutoTrackSessions()Sets whether Bugsnag should automatically capture and report User sessions wheneverthe app enters the foreground. voidsetAutoTrackSessions(boolean autoTrackSessions)Sets whether Bugsnag should automatically capture and report User sessions wheneverthe app enters the foreground. ErrorTypesgetEnabledErrorTypes()Bugsnag will automatically detect different types of error in your application.If you wish to control exactly which types are enabled, set this property. voidsetEnabledErrorTypes(@NonNull() ErrorTypes enabledErrorTypes)Bugsnag will automatically detect different types of error in your application.If you wish to control exactly which types are enabled, set this property. booleangetAutoDetectErrors()If you want to disable automatic detection of all errors, you can set this property to false.By default this property is true. voidsetAutoDetectErrors(boolean autoDetectErrors)If you want to disable automatic detection of all errors, you can set this property to false.By default this property is true. StringgetAppType()If your app's codebase contains different entry-points/processes, but reports to a singleBugsnag project, you might want to add information denoting the type of process the errorcame from. voidsetAppType(@Nullable() String appType)If your app's codebase contains different entry-points/processes, but reports to a singleBugsnag project, you might want to add information denoting the type of process the errorcame from. LoggergetLogger()By default, the notifier's log messages will be logged using android.util.Logwith a "Bugsnag" tag unless the releaseStage is "production". voidsetLogger(@Nullable() Logger logger)By default, the notifier's log messages will be logged using android.util.Logwith a "Bugsnag" tag unless the releaseStage is "production". DeliverygetDelivery()The Delivery implementation used to make network calls to the BugsnagError Reporting andSessions API. voidsetDelivery(@NonNull() Delivery delivery)The Delivery implementation used to make network calls to the BugsnagError Reporting andSessions API. EndpointConfigurationgetEndpoints()Set the endpoints to send data to. voidsetEndpoints(@NonNull() EndpointConfiguration endpoints)Set the endpoints to send data to. intgetMaxBreadcrumbs()Sets the maximum number of breadcrumbs which will be stored. voidsetMaxBreadcrumbs(int maxBreadcrumbs)Sets the maximum number of breadcrumbs which will be stored. intgetMaxPersistedEvents()Sets the maximum number of persisted events which will be stored. voidsetMaxPersistedEvents(int maxPersistedEvents)Sets the maximum number of persisted events which will be stored. intgetMaxReportedThreads()Gets the maximum number of threads that will be reported with an event. voidsetMaxReportedThreads(int maxReportedThreads)Sets the maximum number of threads that will be reported with an event. longgetThreadCollectionTimeLimitMillis()Gets the maximum time for collecting threads and traces.By default, up to 200 threads are reported. voidsetThreadCollectionTimeLimitMillis(long threadCollectionTimeLimitMillis)Sets the maximum time for collecting threads and traces.By default, up to 5000 milliseconds are reported. intgetMaxPersistedSessions()Sets the maximum number of persisted sessions which will be stored. voidsetMaxPersistedSessions(int maxPersistedSessions)Sets the maximum number of persisted sessions which will be stored. intgetMaxStringValueLength()Gets the maximum string length in any metadata field. voidsetMaxStringValueLength(int maxStringValueLength)Sets the maximum string length in any metadata field. StringgetContext()Bugsnag uses the concept of "contexts" to help display and group your errors. voidsetContext(@Nullable() String context)Bugsnag uses the concept of "contexts" to help display and group your errors. Set<Pattern>getRedactedKeys()Sets which values should be removed from any Metadata objects beforesending them to Bugsnag. voidsetRedactedKeys(@NonNull() Set<Pattern> redactedKeys)Sets which values should be removed from any Metadata objects beforesending them to Bugsnag. Set<Pattern>getDiscardClasses()Allows you to specify the fully-qualified name of error classes that will be discardedbefore being sent to Bugsnag if they are detected. voidsetDiscardClasses(@NonNull() Set<Pattern> discardClasses)Allows you to specify the fully-qualified name of error classes that will be discardedbefore being sent to Bugsnag if they are detected. Set<String>getEnabledReleaseStages()By default, Bugsnag will be notified of events that happen in any releaseStage.If you would like to change which release stages notify Bugsnag you can set this property. voidsetEnabledReleaseStages(@Nullable() Set<String> enabledReleaseStages)By default, Bugsnag will be notified of events that happen in any releaseStage.If you would like to change which release stages notify Bugsnag you can set this property. Set<BreadcrumbType>getEnabledBreadcrumbTypes()By default we will automatically add breadcrumbs for common application events such asactivity lifecycle events and system intents. voidsetEnabledBreadcrumbTypes(@Nullable() Set<BreadcrumbType> enabledBreadcrumbTypes)By default we will automatically add breadcrumbs for common application events such asactivity lifecycle events and system intents. Set<Telemetry>getTelemetry()voidsetTelemetry(@NonNull() Set<Telemetry> telemetry)Set which telemetry will be sent to Bugsnag. Set<String>getProjectPackages()Sets which package names Bugsnag should consider as a part of therunning application. voidsetProjectPackages(@NonNull() Set<String> projectPackages)Sets which package names Bugsnag should consider as a part of therunning application. voidaddOnError(@NonNull() OnErrorCallback onError)Add an "on error" callback, to execute code at the point where an error report iscaptured in Bugsnag. voidremoveOnError(@NonNull() OnErrorCallback onError)Removes a previously added "on error" callback voidaddOnBreadcrumb(@NonNull() OnBreadcrumbCallback onBreadcrumb)Add an "on breadcrumb" callback, to execute code before everybreadcrumb captured by Bugsnag. voidremoveOnBreadcrumb(@NonNull() OnBreadcrumbCallback onBreadcrumb)Removes a previously added "on breadcrumb" callback voidaddOnSession(@NonNull() OnSessionCallback onSession)Add an "on session" callback, to execute code before everysession captured by Bugsnag. voidremoveOnSession(@NonNull() OnSessionCallback onSession)Removes a previously added "on session" callback voidaddOnSend(@NonNull() OnSendCallback onSend)Add a callback which will be invoked prior to an event being deliveredto Bugsnag. voidremoveOnSend(@NonNull() OnSendCallback onSend)Remove a callback previously added with addOnSend voidaddMetadata(@NonNull() String section, @NonNull() Map<String, out Object> value)Adds a map of multiple metadata key-value pairs to the specified section. voidaddMetadata(@NonNull() String section, @NonNull() String key, @Nullable() Object value)Adds the specified key and value in the specified section. voidclearMetadata(@NonNull() String section)Removes all the data from the specified section. voidclearMetadata(@NonNull() String section, @NonNull() String key)Removes data with the specified key from the specified section. Map<String, Object>getMetadata(@NonNull() String section)Returns a map of data in the specified section. ObjectgetMetadata(@NonNull() String section, @NonNull() String key)Returns the value of the specified key in the specified section. voidaddFeatureFlag(@NonNull() String name)voidaddFeatureFlag(@NonNull() String name, @Nullable() String variant)voidaddFeatureFlags(@NonNull() Iterable<FeatureFlag> featureFlags)voidclearFeatureFlag(@NonNull() String name)voidclearFeatureFlags()UsergetUser()Returns the currently set User information. voidsetUser(@Nullable() String id, @Nullable() String email, @Nullable() String name)Sets the user associated with the event. voidaddPlugin(@NonNull() Plugin plugin)Adds a plugin which will be loaded when the bugsnag notifier is instantiated. voidsetAttemptDeliveryOnCrash(boolean attemptDeliveryOnCrash)Whether Bugsnag should try to send crashing errors prior to app termination. booleanisAttemptDeliveryOnCrash()Whether Bugsnag should try to send crashing errors prior to app termination. -
Methods inherited from class com.bugsnag.android.CallbackAware
addOnBreadcrumb, addOnError, addOnSession, removeOnBreadcrumb, removeOnError, removeOnSession -
Methods inherited from class com.bugsnag.android.MetadataAware
addMetadata, clearMetadata, getMetadata -
Methods inherited from class com.bugsnag.android.UserAware
getUser, setUser -
Methods inherited from class com.bugsnag.android.FeatureFlagAware
addFeatureFlag, addFeatureFlags, clearFeatureFlag, clearFeatureFlags -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
Configuration
Configuration(String apiKey)
Constructs a new Configuration object with default values.
-
-
Method Detail
-
load
@NonNull() static Configuration load(@NonNull() Context context)
Loads a Configuration object from values supplied as meta-data elements in yourAndroidManifest.
-
setApiKey
void setApiKey(@NonNull() String apiKey)
Changes the API key used for events sent to Bugsnag.
-
getAppVersion
@Nullable() String getAppVersion()
Set the application version sent to Bugsnag. We'll automatically pull your app versionfrom the versionName field in your AndroidManifest.xml file.
-
setAppVersion
void setAppVersion(@Nullable() String appVersion)
Set the application version sent to Bugsnag. We'll automatically pull your app versionfrom the versionName field in your AndroidManifest.xml file.
-
getVersionCode
@Nullable() Integer getVersionCode()
We'll automatically pull your versionCode from the versionCode fieldin your AndroidManifest.xml file. If you'd like to override this youcan set this property.
-
setVersionCode
void setVersionCode(@Nullable() Integer versionCode)
We'll automatically pull your versionCode from the versionCode fieldin your AndroidManifest.xml file. If you'd like to override this youcan set this property.
-
getReleaseStage
@Nullable() String getReleaseStage()
If you would like to distinguish between errors that happen in different stages of theapplication release process (development, production, etc.) you can set the releaseStagethat is reported to Bugsnag.
If you are running a debug build, we'll automatically set this to "development",otherwise it is set to "production". You can control whether events are sent forspecific release stages using the enabledReleaseStages option.
-
setReleaseStage
void setReleaseStage(@Nullable() String releaseStage)
If you would like to distinguish between errors that happen in different stages of theapplication release process (development, production, etc.) you can set the releaseStagethat is reported to Bugsnag.
If you are running a debug build, we'll automatically set this to "development",otherwise it is set to "production". You can control whether events are sent forspecific release stages using the enabledReleaseStages option.
-
getSendThreads
@NonNull() ThreadSendPolicy getSendThreads()
Controls whether we should capture and serialize the state of all threads at the timeof an error.
By default sendThreads is set to Thread.ThreadSendPolicy.ALWAYS. This can be set toThread.ThreadSendPolicy.NEVER to disable or Thread.ThreadSendPolicy.UNHANDLED_ONLYto only do so for unhandled errors.
-
setSendThreads
void setSendThreads(@NonNull() ThreadSendPolicy sendThreads)
Controls whether we should capture and serialize the state of all threads at the timeof an error.
By default sendThreads is set to Thread.ThreadSendPolicy.ALWAYS. This can be set toThread.ThreadSendPolicy.NEVER to disable or Thread.ThreadSendPolicy.UNHANDLED_ONLYto only do so for unhandled errors.
-
getPersistUser
boolean getPersistUser()
Set whether or not Bugsnag should persist user information between application sessions.
If enabled then any user information set will be re-used until the user information isremoved manually by calling setUser with null arguments.
-
setPersistUser
void setPersistUser(boolean persistUser)
Set whether Bugsnag should persist user information between application sessions.
If enabled then any user information set will be re-used until the user information isremoved manually by calling setUser with null arguments.
-
getGenerateAnonymousId
boolean getGenerateAnonymousId()
Set whether Bugsnag should generate an anonymous ID and persist it in local storage
If disabled, any device ID that has been persisted will not be retrieved, and no newdevice ID will be generated or stored
-
setGenerateAnonymousId
void setGenerateAnonymousId(boolean generateAnonymousId)
Set whether Bugsnag should generate an anonymous ID and persist it in local storage
If disabled, any device ID that has been persisted will not be retrieved, and no newdevice ID will be generated or stored
-
getPersistenceDirectory
@Nullable() File getPersistenceDirectory()
Sets the directory where event and session JSON payloads should be persisted if a networkrequest is not successful. If you use Bugsnag in multiple processes, then a uniquepersistenceDirectory must be configured for each process to prevent duplicaterequests being made by each instantiation of Bugsnag.
The persistenceDirectory also stores user information if getPersistUser has beenset to true.By default, bugsnag sets the persistenceDirectory to getCacheDir.If the persistenceDirectory is changed between application launches, no attempt will be madeto deliver events or sessions cached in the previous location.
-
setPersistenceDirectory
void setPersistenceDirectory(@Nullable() File directory)
Sets the directory where event and session JSON payloads should be persisted if a networkrequest is not successful. If you use Bugsnag in multiple processes, then a uniquepersistenceDirectory must be configured for each process to prevent duplicaterequests being made by each instantiation of Bugsnag.
The persistenceDirectory also stores user information if getPersistUser has beenset to true.By default, Bugsnag sets the persistenceDirectory to getCacheDir.If the persistenceDirectory is changed between application launches, no attempt will be madeto deliver events or sessions cached in the previous location.
-
getSendLaunchCrashesSynchronously
boolean getSendLaunchCrashesSynchronously()
Sets whether Bugsnag should send crashes synchronously that occurred duringthe application's launch period. By default this behavior is enabled.
-
setSendLaunchCrashesSynchronously
void setSendLaunchCrashesSynchronously(boolean sendLaunchCrashesSynchronously)
Sets whether Bugsnag should send crashes synchronously that occurred duringthe application's launch period. By default this behavior is enabled.
-
getLaunchDurationMillis
long getLaunchDurationMillis()
Sets the threshold in milliseconds for an uncaught error to be considered as a crash onlaunch. If a crash is detected on launch, Bugsnag will attempt to send the most recentevent synchronously.
By default, this value is set at 5,000ms. Setting the value to 0 will count all crashesas launch crashes until markLaunchCompleted is called.
-
setLaunchDurationMillis
void setLaunchDurationMillis(long launchDurationMillis)
Sets the threshold in milliseconds for an uncaught error to be considered as a crash onlaunch. If a crash is detected on launch, Bugsnag will attempt to send the most recentevent synchronously.
By default, this value is set at 5,000ms. Setting the value to 0 will count all crashesas launch crashes until markLaunchCompleted() is called.
-
getAutoTrackSessions
boolean getAutoTrackSessions()
Sets whether Bugsnag should automatically capture and report User sessions wheneverthe app enters the foreground.
By default this behavior is enabled.
-
setAutoTrackSessions
void setAutoTrackSessions(boolean autoTrackSessions)
Sets whether Bugsnag should automatically capture and report User sessions wheneverthe app enters the foreground.
By default this behavior is enabled.
-
getEnabledErrorTypes
@NonNull() ErrorTypes getEnabledErrorTypes()
Bugsnag will automatically detect different types of error in your application.If you wish to control exactly which types are enabled, set this property.
-
setEnabledErrorTypes
void setEnabledErrorTypes(@NonNull() ErrorTypes enabledErrorTypes)
Bugsnag will automatically detect different types of error in your application.If you wish to control exactly which types are enabled, set this property.
-
getAutoDetectErrors
boolean getAutoDetectErrors()
If you want to disable automatic detection of all errors, you can set this property to false.By default this property is true.
Setting autoDetectErrors to false will disable all automatic errors, regardless of theerror types enabled by enabledErrorTypes
-
setAutoDetectErrors
void setAutoDetectErrors(boolean autoDetectErrors)
If you want to disable automatic detection of all errors, you can set this property to false.By default this property is true.
Setting autoDetectErrors to false will disable all automatic errors, regardless of theerror types enabled by enabledErrorTypes
-
getAppType
@Nullable() String getAppType()
If your app's codebase contains different entry-points/processes, but reports to a singleBugsnag project, you might want to add information denoting the type of process the errorcame from.
This information can be used in the dashboard to filter errors and to determine whetheran error is limited to a subset of appTypes.
By default, this value is set to 'android'.
-
setAppType
void setAppType(@Nullable() String appType)
If your app's codebase contains different entry-points/processes, but reports to a singleBugsnag project, you might want to add information denoting the type of process the errorcame from.
This information can be used in the dashboard to filter errors and to determine whetheran error is limited to a subset of appTypes.
By default, this value is set to 'android'.
-
getLogger
@Nullable() Logger getLogger()
By default, the notifier's log messages will be logged using android.util.Logwith a "Bugsnag" tag unless the releaseStage is "production".
To override this behavior, an alternative instance can be provided that implements theLogger interface.
-
setLogger
void setLogger(@Nullable() Logger logger)
By default, the notifier's log messages will be logged using android.util.Logwith a "Bugsnag" tag unless the releaseStage is "production".
To override this behavior, an alternative instance can be provided that implements theLogger interface.
-
getDelivery
@NonNull() Delivery getDelivery()
The Delivery implementation used to make network calls to the BugsnagError Reporting andSessions API.
This may be useful if you have requirements such as certificate pinning and rotation,which are not supported by the default implementation.
To provide custom delivery functionality, create a class which implements the Deliveryinterface. Please note that request bodies must match the structure specified in theError Reporting andSessions API documentation.
You can use the return type from the deliver functions to control the strategy forretrying the transmission at a later date.
If UNDELIVERED is returned, the notifier will automatically cachethe payload and trigger delivery later on. Otherwise, if either DELIVERED or FAILURE is returned the notifierwill remove any cached payload and no further delivery will be attempted.
-
setDelivery
void setDelivery(@NonNull() Delivery delivery)
The Delivery implementation used to make network calls to the BugsnagError Reporting andSessions API.
This may be useful if you have requirements such as certificate pinning and rotation,which are not supported by the default implementation.
To provide custom delivery functionality, create a class which implements the Deliveryinterface. Please note that request bodies must match the structure specified in theError Reporting andSessions API documentation.
You can use the return type from the deliver functions to control the strategy forretrying the transmission at a later date.
If UNDELIVERED is returned, the notifier will automatically cachethe payload and trigger delivery later on. Otherwise, if either DELIVERED or FAILURE is returned the notifierwill remove any cached payload and no further delivery will be attempted.
-
getEndpoints
@NonNull() EndpointConfiguration getEndpoints()
Set the endpoints to send data to. By default, we'll send error reports to
{@code https://notify.bugsnag.com}, and sessions to{@code https://sessions.bugsnag.com},but you can override this if you are using Bugsnag Enterprise to point to your ownBugsnag endpoints.
-
setEndpoints
void setEndpoints(@NonNull() EndpointConfiguration endpoints)
Set the endpoints to send data to. By default, we'll send error reports to
{@code https://notify.bugsnag.com}, and sessions to{@code https://sessions.bugsnag.com},but you can override this if you are using Bugsnag Enterprise to point to your ownBugsnag endpoints.
-
getMaxBreadcrumbs
int getMaxBreadcrumbs()
Sets the maximum number of breadcrumbs which will be stored. Once the threshold is reached,the oldest breadcrumbs will be deleted.
By default, 100 breadcrumbs are stored: this can be amended up to a maximum of 500.
-
setMaxBreadcrumbs
void setMaxBreadcrumbs(int maxBreadcrumbs)
Sets the maximum number of breadcrumbs which will be stored. Once the threshold is reached,the oldest breadcrumbs will be deleted.
By default, 100 breadcrumbs are stored: this can be amended up to a maximum of 500.
-
getMaxPersistedEvents
int getMaxPersistedEvents()
Sets the maximum number of persisted events which will be stored. Once the threshold isreached, the oldest event will be deleted.
By default, 32 events are persisted.
-
setMaxPersistedEvents
void setMaxPersistedEvents(int maxPersistedEvents)
Sets the maximum number of persisted events which will be stored. Once the threshold isreached, the oldest event will be deleted.
By default, 32 events are persisted.
-
getMaxReportedThreads
int getMaxReportedThreads()
Gets the maximum number of threads that will be reported with an event. Once the threshold isreached, all remaining threads will be omitted.
By default, up to 200 threads are reported.
-
setMaxReportedThreads
void setMaxReportedThreads(int maxReportedThreads)
Sets the maximum number of threads that will be reported with an event. Once the threshold isreached, all remaining threads will be omitted.
By default, up to 200 threads are reported.
-
getThreadCollectionTimeLimitMillis
long getThreadCollectionTimeLimitMillis()
Gets the maximum time for collecting threads and traces.By default, up to 200 threads are reported.
-
setThreadCollectionTimeLimitMillis
void setThreadCollectionTimeLimitMillis(long threadCollectionTimeLimitMillis)
Sets the maximum time for collecting threads and traces.By default, up to 5000 milliseconds are reported.
-
getMaxPersistedSessions
int getMaxPersistedSessions()
Sets the maximum number of persisted sessions which will be stored. Once the threshold isreached, the oldest session will be deleted.
By default, 128 sessions are persisted.
-
setMaxPersistedSessions
void setMaxPersistedSessions(int maxPersistedSessions)
Sets the maximum number of persisted sessions which will be stored. Once the threshold isreached, the oldest session will be deleted.
By default, 128 sessions are persisted.
-
getMaxStringValueLength
int getMaxStringValueLength()
Gets the maximum string length in any metadata field. Once the threshold isreached in a particular string, all excess characters will be deleted.
By default, the limit is 10,000.
-
setMaxStringValueLength
void setMaxStringValueLength(int maxStringValueLength)
Sets the maximum string length in any metadata field. Once the threshold isreached in a particular string, all excess characters will be deleted.
By default, the limit is 10,000.
-
getContext
@Nullable() String getContext()
Bugsnag uses the concept of "contexts" to help display and group your errors. Contextsrepresent what was happening in your application at the time an error occurs.
In an android app the "context" is automatically set as the foreground Activity.If you would like to set this value manually, you should alter this property.
-
setContext
void setContext(@Nullable() String context)
Bugsnag uses the concept of "contexts" to help display and group your errors. Contextsrepresent what was happening in your application at the time an error occurs.
In an android app the "context" is automatically set as the foreground Activity.If you would like to set this value manually, you should alter this property.
-
getRedactedKeys
@NonNull() Set<Pattern> getRedactedKeys()
Sets which values should be removed from any Metadata objects beforesending them to Bugsnag. Use this if you want to ensure you don't sendsensitive data such as passwords, and credit card numbers to ourservers. Any keys which contain these strings will be filtered.
By default, redactedKeys is set to "password"
-
setRedactedKeys
void setRedactedKeys(@NonNull() Set<Pattern> redactedKeys)
Sets which values should be removed from any Metadata objects beforesending them to Bugsnag. Use this if you want to ensure you don't sendsensitive data such as passwords, and credit card numbers to ourservers. Any keys which contain these strings will be filtered.
By default, redactedKeys is set to "password"
-
getDiscardClasses
@NonNull() Set<Pattern> getDiscardClasses()
Allows you to specify the fully-qualified name of error classes that will be discardedbefore being sent to Bugsnag if they are detected. The notifier performs an exactmatch against the canonical class name.
-
setDiscardClasses
void setDiscardClasses(@NonNull() Set<Pattern> discardClasses)
Allows you to specify the fully-qualified name of error classes that will be discardedbefore being sent to Bugsnag if they are detected. The notifier performs an exactmatch against the canonical class name.
-
getEnabledReleaseStages
@Nullable() Set<String> getEnabledReleaseStages()
By default, Bugsnag will be notified of events that happen in any releaseStage.If you would like to change which release stages notify Bugsnag you can set this property.
-
setEnabledReleaseStages
void setEnabledReleaseStages(@Nullable() Set<String> enabledReleaseStages)
By default, Bugsnag will be notified of events that happen in any releaseStage.If you would like to change which release stages notify Bugsnag you can set this property.
-
getEnabledBreadcrumbTypes
@Nullable() Set<BreadcrumbType> getEnabledBreadcrumbTypes()
By default we will automatically add breadcrumbs for common application events such asactivity lifecycle events and system intents. To amend this behavior,override the enabled breadcrumb types. All breadcrumbs can be disabled by providing anempty set.
The following breadcrumb types can be enabled:
- Captured errors: left when an error event is sent to the Bugsnag API.
- Manual breadcrumbs: left via the Bugsnag.leaveBreadcrumb function.
- Navigation changes: left for Activity Lifecycle events to track the user's journey inthe app.
- State changes: state breadcrumbs are left for system broadcast events. For example:battery warnings, airplane mode, etc.
- User interaction: left when the user performs certain system operations.
-
setEnabledBreadcrumbTypes
void setEnabledBreadcrumbTypes(@Nullable() Set<BreadcrumbType> enabledBreadcrumbTypes)
By default we will automatically add breadcrumbs for common application events such asactivity lifecycle events and system intents. To amend this behavior,override the enabled breadcrumb types. All breadcrumbs can be disabled by providing anempty set.
The following breadcrumb types can be enabled:
- Captured errors: left when an error event is sent to the Bugsnag API.
- Manual breadcrumbs: left via the Bugsnag.leaveBreadcrumb function.
- Navigation changes: left for Activity Lifecycle events to track the user's journey inthe app.
- State changes: state breadcrumbs are left for system broadcast events. For example:battery warnings, airplane mode, etc.
- User interaction: left when the user performs certain system operations.
-
getTelemetry
@NonNull() Set<Telemetry> getTelemetry()
-
setTelemetry
void setTelemetry(@NonNull() Set<Telemetry> telemetry)
Set which telemetry will be sent to Bugsnag. By default, all telemetry is enabled.
The following telemetry can be enabled:
- internal errors: Errors in the Bugsnag SDK itself
- usage: Differences from the default configuration
-
getProjectPackages
@NonNull() Set<String> getProjectPackages()
Sets which package names Bugsnag should consider as a part of therunning application. We mark stacktrace lines as in-project if theyoriginate from any of these packages and this allows us to improvethe visual display of the stacktrace on the dashboard.
By default, projectPackages is set to be the package you called start from.
-
setProjectPackages
void setProjectPackages(@NonNull() Set<String> projectPackages)
Sets which package names Bugsnag should consider as a part of therunning application. We mark stacktrace lines as in-project if theyoriginate from any of these packages and this allows us to improvethe visual display of the stacktrace on the dashboard.
By default, projectPackages is set to be the package you called start from.
-
addOnError
void addOnError(@NonNull() OnErrorCallback onError)
Add an "on error" callback, to execute code at the point where an error report iscaptured in Bugsnag.
You can use this to add or modify information attached to an Eventbefore it is sent to your dashboard. You can also return
{@code false}from any callback to prevent delivery. "on error"callbacks do not run before reports generated in the eventof immediate app termination from crashes in C/C++ code.For example:
{@code * Bugsnag.addOnError((event) -> { * event.setSeverity(Severity.INFO); * return true; * }); * }- Parameters:
onError- a callback to run before sending errors to Bugsnag
-
removeOnError
void removeOnError(@NonNull() OnErrorCallback onError)
Removes a previously added "on error" callback
- Parameters:
onError- the callback to remove
-
addOnBreadcrumb
void addOnBreadcrumb(@NonNull() OnBreadcrumbCallback onBreadcrumb)
Add an "on breadcrumb" callback, to execute code before everybreadcrumb captured by Bugsnag.
You can use this to modify breadcrumbs before they are stored by Bugsnag.You can also return
{@code false}from any callback to ignore a breadcrumb.For example:
{@code * Bugsnag.addOnBreadcrumb((breadcrumb) -> { * return false; // ignore the breadcrumb * }); * }- Parameters:
onBreadcrumb- a callback to run before a breadcrumb is captured
-
removeOnBreadcrumb
void removeOnBreadcrumb(@NonNull() OnBreadcrumbCallback onBreadcrumb)
Removes a previously added "on breadcrumb" callback
- Parameters:
onBreadcrumb- the callback to remove
-
addOnSession
void addOnSession(@NonNull() OnSessionCallback onSession)
Add an "on session" callback, to execute code before everysession captured by Bugsnag.
You can use this to modify sessions before they are stored by Bugsnag.You can also return
{@code false}from any callback to ignore a session.For example:
{@code * Bugsnag.onSession(new OnSessionCallback() { * public boolean onSession(Session session) { * return false; // ignore the session * } * }); * }- Parameters:
onSession- a callback to run before a session is captured
-
removeOnSession
void removeOnSession(@NonNull() OnSessionCallback onSession)
Removes a previously added "on session" callback
- Parameters:
onSession- the callback to remove
-
addOnSend
void addOnSend(@NonNull() OnSendCallback onSend)
Add a callback which will be invoked prior to an event being deliveredto Bugsnag. The callback can be used to modify events or canceldelivering the event altogether by returning
{@code false}. Notethat the callback may be invoked in the current or a subsequent applaunch depending on whether the app terminated prior to delivering theevent.- Parameters:
onSend- the callback to add
-
removeOnSend
void removeOnSend(@NonNull() OnSendCallback onSend)
Remove a callback previously added with addOnSend
- Parameters:
onSend- the callback to remove
-
addMetadata
void addMetadata(@NonNull() String section, @NonNull() Map<String, out Object> value)
Adds a map of multiple metadata key-value pairs to the specified section.
-
addMetadata
void addMetadata(@NonNull() String section, @NonNull() String key, @Nullable() Object value)
Adds the specified key and value in the specified section. The value can be ofany primitive type or a collection such as a map, set or array.
-
clearMetadata
void clearMetadata(@NonNull() String section)
Removes all the data from the specified section.
-
clearMetadata
void clearMetadata(@NonNull() String section, @NonNull() String key)
Removes data with the specified key from the specified section.
-
getMetadata
@Nullable() Map<String, Object> getMetadata(@NonNull() String section)
Returns a map of data in the specified section.
-
getMetadata
@Nullable() Object getMetadata(@NonNull() String section, @NonNull() String key)
Returns the value of the specified key in the specified section.
-
addFeatureFlag
void addFeatureFlag(@NonNull() String name)
-
addFeatureFlag
void addFeatureFlag(@NonNull() String name, @Nullable() String variant)
-
addFeatureFlags
void addFeatureFlags(@NonNull() Iterable<FeatureFlag> featureFlags)
-
clearFeatureFlag
void clearFeatureFlag(@NonNull() String name)
-
clearFeatureFlags
void clearFeatureFlags()
-
setUser
void setUser(@Nullable() String id, @Nullable() String email, @Nullable() String name)
Sets the user associated with the event.
-
addPlugin
void addPlugin(@NonNull() Plugin plugin)
Adds a plugin which will be loaded when the bugsnag notifier is instantiated.
-
setAttemptDeliveryOnCrash
void setAttemptDeliveryOnCrash(boolean attemptDeliveryOnCrash)
Whether Bugsnag should try to send crashing errors prior to app termination.
Delivery will only be attempted for uncaught Java / Kotlin exceptions or errors, andwhile in progress will block the crashing thread for up to 3 seconds.
Delivery on crash should be considered unreliable due to the necessary short timeout andpotential for generating "errors on errors".
Use of this feature is discouraged because it:
- may cause Application Not Responding (ANR) errors on-top of existing crashes
- will result in duplicate errors in your Dashboard when errors are not detected as sentbefore termination
- may prevent other error handlers from detecting or reporting a crash
By default this value is
{@code false}.- Parameters:
attemptDeliveryOnCrash-{@code true}if Bugsnag should try to send crashing errorsprior to app termination
-
isAttemptDeliveryOnCrash
boolean isAttemptDeliveryOnCrash()
Whether Bugsnag should try to send crashing errors prior to app termination.
-
-
-
-