public class Client
extends java.lang.Object
Bugsnag| Constructor and Description |
|---|
Client(android.content.Context androidContext)
Initialize a Bugsnag client
|
Client(android.content.Context androidContext,
Configuration configuration)
Initialize a Bugsnag client
|
Client(android.content.Context androidContext,
java.lang.String apiKey)
Initialize a Bugsnag client
|
Client(android.content.Context androidContext,
java.lang.String apiKey,
boolean enableExceptionHandler)
Initialize a Bugsnag client
|
| Modifier and Type | Method and Description |
|---|---|
void |
addToTab(java.lang.String tab,
java.lang.String key,
java.lang.Object value)
Add diagnostic information to every error report.
|
void |
beforeNotify(BeforeNotify beforeNotify)
Add a "before notify" callback, to execute code before every
report to Bugsnag.
|
void |
clearBreadcrumbs()
Clear any breadcrumbs that have been left so far.
|
void |
clearTab(java.lang.String tabName)
Remove a tab of app-wide diagnostic information
|
void |
clearUser()
Removes the current user data and sets it back to defaults
|
void |
disableExceptionHandler()
Disable automatic reporting of unhandled exceptions.
|
void |
enableExceptionHandler()
Enable automatic reporting of unhandled exceptions.
|
java.lang.String |
getContext()
Gets the context to be sent to Bugsnag.
|
MetaData |
getMetaData()
Get the global diagnostic information currently stored in MetaData.
|
void |
leaveBreadcrumb(java.lang.String breadcrumb)
Leave a "breadcrumb" log message, representing an action that occurred
in your app, to aid with debugging.
|
void |
leaveBreadcrumb(java.lang.String name,
BreadcrumbType type,
java.util.Map<java.lang.String,java.lang.String> metadata) |
void |
notify(java.lang.String name,
java.lang.String message,
java.lang.StackTraceElement[] stacktrace,
Callback callback)
Notify Bugsnag of an error
|
void |
notify(java.lang.String name,
java.lang.String message,
java.lang.StackTraceElement[] stacktrace,
Severity severity,
MetaData metaData)
Deprecated.
Use
notify(String,String,StackTraceElement[],Callback)
to send and modify error reports |
void |
notify(java.lang.String name,
java.lang.String message,
java.lang.String context,
java.lang.StackTraceElement[] stacktrace,
Severity severity,
MetaData metaData)
Deprecated.
Use
notify(String,String,StackTraceElement[],Callback)
to send and modify error reports |
void |
notify(java.lang.Throwable exception)
Notify Bugsnag of a handled exception
|
void |
notify(java.lang.Throwable exception,
Callback callback)
Notify Bugsnag of a handled exception
|
void |
notify(java.lang.Throwable exception,
MetaData metaData)
Deprecated.
Use
notify(Throwable,Callback)
to send and modify error reports |
void |
notify(java.lang.Throwable exception,
Severity severity)
Notify Bugsnag of a handled exception
|
void |
notify(java.lang.Throwable exception,
Severity severity,
MetaData metaData)
Deprecated.
Use
notify(Throwable,Callback) to send and
modify error reports |
void |
notifyBlocking(java.lang.String name,
java.lang.String message,
java.lang.StackTraceElement[] stacktrace,
Callback callback)
Notify Bugsnag of an error
|
void |
notifyBlocking(java.lang.String name,
java.lang.String message,
java.lang.StackTraceElement[] stacktrace,
Severity severity,
MetaData metaData)
Deprecated.
Use
notifyBlocking(String,String,StackTraceElement[],Callback)
to send and modify error reports |
void |
notifyBlocking(java.lang.String name,
java.lang.String message,
java.lang.String context,
java.lang.StackTraceElement[] stacktrace,
Severity severity,
MetaData metaData)
Deprecated.
Use
notifyBlocking(String,String,StackTraceElement[],Callback)
to send and modify error reports |
void |
notifyBlocking(java.lang.Throwable exception)
Notify Bugsnag of a handled exception
|
void |
notifyBlocking(java.lang.Throwable exception,
Callback callback)
Notify Bugsnag of a handled exception
|
void |
notifyBlocking(java.lang.Throwable exception,
MetaData metaData)
Deprecated.
Use
notify(Throwable,Callback)
to send and modify error reports |
void |
notifyBlocking(java.lang.Throwable exception,
Severity severity)
Notify Bugsnag of a handled exception
|
void |
notifyBlocking(java.lang.Throwable exception,
Severity severity,
MetaData metaData)
Deprecated.
Use
notifyBlocking(Throwable,Callback) to send
and modify error reports |
void |
setAppVersion(java.lang.String appVersion)
Set the application version sent to Bugsnag.
|
void |
setBuildUUID(java.lang.String buildUUID)
Set the buildUUID to your own value.
|
void |
setContext(java.lang.String context)
Set the context sent to Bugsnag.
|
void |
setEndpoint(java.lang.String endpoint)
Set the endpoint to send data to.
|
void |
setFilters(java.lang.String... filters)
Set which keys should be filtered when sending metaData to Bugsnag.
|
void |
setIgnoreClasses(java.lang.String... ignoreClasses)
Set which exception classes should be ignored (not sent) by Bugsnag.
|
void |
setMaxBreadcrumbs(int numBreadcrumbs)
Set the maximum number of breadcrumbs to keep and sent to Bugsnag.
|
void |
setMetaData(MetaData metaData)
Set the global diagnostic information to be send with every error.
|
void |
setNotifyReleaseStages(java.lang.String... notifyReleaseStages)
Set for which releaseStages errors should be sent to Bugsnag.
|
void |
setProjectPackages(java.lang.String... projectPackages)
Set which packages should be considered part of your application.
|
void |
setReleaseStage(java.lang.String releaseStage)
Set the current "release stage" of your application.
|
void |
setSendThreads(boolean sendThreads)
Set whether to send thread-state with report.
|
void |
setUser(java.lang.String id,
java.lang.String email,
java.lang.String name)
Set details of the user currently using your application.
|
void |
setUserEmail(java.lang.String email)
Set the email address of the current user.
|
void |
setUserId(java.lang.String id)
Set a unique identifier for the user currently using your application.
|
void |
setUserName(java.lang.String name)
Set the name of the current user.
|
public Client(android.content.Context androidContext)
androidContext - an Android context, usually thispublic Client(android.content.Context androidContext,
java.lang.String apiKey)
androidContext - an Android context, usually thisapiKey - your Bugsnag API key from your Bugsnag dashboardpublic Client(android.content.Context androidContext,
java.lang.String apiKey,
boolean enableExceptionHandler)
androidContext - an Android context, usually thisapiKey - your Bugsnag API key from your Bugsnag dashboardenableExceptionHandler - should we automatically handle uncaught exceptions?public Client(android.content.Context androidContext,
Configuration configuration)
androidContext - an Android context, usually thisconfiguration - a configuration for the Clientpublic void setAppVersion(java.lang.String appVersion)
appVersion - the app version to sendpublic java.lang.String getContext()
public void setContext(java.lang.String context)
context - set what was happening at the time of a crashpublic void setEndpoint(java.lang.String endpoint)
endpoint - the custom endpoint to send report topublic void setBuildUUID(java.lang.String buildUUID)
buildUUID - the buildUUID.public void setFilters(java.lang.String... filters)
filters - a list of keys to filter from metaDatapublic void setIgnoreClasses(java.lang.String... ignoreClasses)
ignoreClasses - a list of exception classes to ignorepublic void setNotifyReleaseStages(java.lang.String... notifyReleaseStages)
notifyReleaseStages - a list of releaseStages to notify forsetReleaseStage(java.lang.String)public void setProjectPackages(java.lang.String... projectPackages)
projectPackages - a list of package namespublic void setReleaseStage(java.lang.String releaseStage)
releaseStage - the release stage of the appsetNotifyReleaseStages(java.lang.String...)public void setSendThreads(boolean sendThreads)
sendThreads - should we send thread-state with report?public void setUser(java.lang.String id,
java.lang.String email,
java.lang.String name)
id - a unique identifier of the current user (defaults to a unique id)email - the email address of the current username - the name of the current userpublic void clearUser()
public void setUserId(java.lang.String id)
id - a unique identifier of the current userpublic void setUserEmail(java.lang.String email)
email - the email address of the current userpublic void setUserName(java.lang.String name)
name - the name of the current userpublic void beforeNotify(BeforeNotify beforeNotify)
false from any callback to halt execution.
For example:
client.beforeNotify(new BeforeNotify() {
public boolean run(Error error) {
error.setSeverity(Severity.INFO);
return true;
}
})beforeNotify - a callback to run before sending errors to BugsnagBeforeNotifypublic void notify(java.lang.Throwable exception)
exception - the exception to send to Bugsnagpublic void notifyBlocking(java.lang.Throwable exception)
exception - the exception to send to Bugsnagpublic void notify(java.lang.Throwable exception,
Callback callback)
exception - the exception to send to Bugsnagcallback - callback invoked on the generated error report for
additional modificationpublic void notifyBlocking(java.lang.Throwable exception,
Callback callback)
exception - the exception to send to Bugsnagcallback - callback invoked on the generated error report for
additional modificationpublic void notify(java.lang.String name,
java.lang.String message,
java.lang.StackTraceElement[] stacktrace,
Callback callback)
name - the error name or classmessage - the error messagecontext - the error contextstacktrace - the stackframes associated with the errorcallback - callback invoked on the generated error report for
additional modificationpublic void notifyBlocking(java.lang.String name,
java.lang.String message,
java.lang.StackTraceElement[] stacktrace,
Callback callback)
name - the error name or classmessage - the error messagecontext - the error contextstacktrace - the stackframes associated with the errorcallback - callback invoked on the generated error report for
additional modificationpublic void notify(java.lang.Throwable exception,
Severity severity)
exception - the exception to send to Bugsnagseverity - the severity of the error, one of Severity.ERROR,
Severity.WARNING or Severity.INFOpublic void notifyBlocking(java.lang.Throwable exception,
Severity severity)
exception - the exception to send to Bugsnagseverity - the severity of the error, one of Severity.ERROR,
Severity.WARNING or Severity.INFOpublic void addToTab(java.lang.String tab,
java.lang.String key,
java.lang.Object value)
tab - the dashboard tab to add diagnostic data tokey - the name of the diagnostic informationvalue - the contents of the diagnostic informationpublic void clearTab(java.lang.String tabName)
tabName - the dashboard tab to remove diagnostic data frompublic MetaData getMetaData()
MetaDatapublic void setMetaData(MetaData metaData)
MetaDatapublic void leaveBreadcrumb(java.lang.String breadcrumb)
breadcrumb - the log message to leave (max 140 chars)public void leaveBreadcrumb(java.lang.String name,
BreadcrumbType type,
java.util.Map<java.lang.String,java.lang.String> metadata)
public void setMaxBreadcrumbs(int numBreadcrumbs)
numBreadcrumbs - number of breadcrumb log messages to sendpublic void clearBreadcrumbs()
public void enableExceptionHandler()
public void disableExceptionHandler()
public void notify(java.lang.Throwable exception,
MetaData metaData)
notify(Throwable,Callback)
to send and modify error reportsexception - the exception to send to BugsnagmetaData - additional information to send with the exceptionpublic void notifyBlocking(java.lang.Throwable exception,
MetaData metaData)
notify(Throwable,Callback)
to send and modify error reportsexception - the exception to send to BugsnagmetaData - additional information to send with the exception@Deprecated
public void notify(java.lang.Throwable exception,
Severity severity,
MetaData metaData)
notify(Throwable,Callback) to send and
modify error reportsexception - the exception to send to Bugsnagseverity - the severity of the error, one of Severity.ERROR,
Severity.WARNING or Severity.INFOmetaData - additional information to send with the exception@Deprecated
public void notifyBlocking(java.lang.Throwable exception,
Severity severity,
MetaData metaData)
notifyBlocking(Throwable,Callback) to send
and modify error reportsexception - the exception to send to Bugsnagseverity - the severity of the error, one of Severity.ERROR,
Severity.WARNING or Severity.INFOmetaData - additional information to send with the exception@Deprecated
public void notify(java.lang.String name,
java.lang.String message,
java.lang.StackTraceElement[] stacktrace,
Severity severity,
MetaData metaData)
notify(String,String,StackTraceElement[],Callback)
to send and modify error reportsname - the error name or classmessage - the error messagestacktrace - the stackframes associated with the errorseverity - the severity of the error, one of Severity.ERROR,
Severity.WARNING or Severity.INFOmetaData - additional information to send with the exception@Deprecated
public void notifyBlocking(java.lang.String name,
java.lang.String message,
java.lang.StackTraceElement[] stacktrace,
Severity severity,
MetaData metaData)
notifyBlocking(String,String,StackTraceElement[],Callback)
to send and modify error reportsname - the error name or classmessage - the error messagestacktrace - the stackframes associated with the errorseverity - the severity of the error, one of Severity.ERROR,
Severity.WARNING or Severity.INFOmetaData - additional information to send with the exception@Deprecated
public void notify(java.lang.String name,
java.lang.String message,
java.lang.String context,
java.lang.StackTraceElement[] stacktrace,
Severity severity,
MetaData metaData)
notify(String,String,StackTraceElement[],Callback)
to send and modify error reportsname - the error name or classmessage - the error messagecontext - the error contextstacktrace - the stackframes associated with the errorseverity - the severity of the error, one of Severity.ERROR,
Severity.WARNING or Severity.INFOmetaData - additional information to send with the exception@Deprecated
public void notifyBlocking(java.lang.String name,
java.lang.String message,
java.lang.String context,
java.lang.StackTraceElement[] stacktrace,
Severity severity,
MetaData metaData)
notifyBlocking(String,String,StackTraceElement[],Callback)
to send and modify error reportsname - the error name or classmessage - the error messagecontext - the error contextstacktrace - the stackframes associated with the errorseverity - the severity of the error, one of Severity.ERROR,
Severity.WARNING or Severity.INFOmetaData - additional information to send with the exception