Package backtraceio.library.base
Class BacktraceBase
- java.lang.Object
-
- backtraceio.library.base.BacktraceBase
-
- All Implemented Interfaces:
Client
- Direct Known Subclasses:
BacktraceClient
public class BacktraceBase extends java.lang.Object implements Client
Base Backtrace Android client
-
-
Field Summary
Fields Modifier and Type Field Description java.util.List<java.lang.String>attachmentsFile attachments to attach to crashes and reports.java.util.Map<java.lang.String,java.lang.Object>attributesGet custom client attributes.protected android.content.ContextcontextApplication contextDatabasedatabaseBacktrace database instanceMetricsmetricsBacktrace metrics instancestatic java.lang.StringversionBacktrace client version
-
Constructor Summary
Constructors Constructor Description BacktraceBase(android.content.Context context, BacktraceCredentials credentials)Initialize new client instance with BacktraceCredentialsBacktraceBase(android.content.Context context, BacktraceCredentials credentials, Database database)Initialize new client instance with BacktraceCredentialsBacktraceBase(android.content.Context context, BacktraceCredentials credentials, Database database, java.util.List<java.lang.String> attachments)Initialize new client instance with BacktraceCredentialsBacktraceBase(android.content.Context context, BacktraceCredentials credentials, Database database, java.util.Map<java.lang.String,java.lang.Object> attributes)Initialize new client instance with BacktraceCredentialsBacktraceBase(android.content.Context context, BacktraceCredentials credentials, Database database, java.util.Map<java.lang.String,java.lang.Object> attributes, java.util.List<java.lang.String> attachments)Initialize new client instance with BacktraceCredentialsBacktraceBase(android.content.Context context, BacktraceCredentials credentials, BacktraceDatabaseSettings databaseSettings)Initialize new client instance with BacktraceCredentialsBacktraceBase(android.content.Context context, BacktraceCredentials credentials, BacktraceDatabaseSettings databaseSettings, java.util.List<java.lang.String> attachments)Initialize new client instance with BacktraceCredentialsBacktraceBase(android.content.Context context, BacktraceCredentials credentials, BacktraceDatabaseSettings databaseSettings, java.util.Map<java.lang.String,java.lang.Object> attributes)Initialize new client instance with BacktraceCredentialsBacktraceBase(android.content.Context context, BacktraceCredentials credentials, BacktraceDatabaseSettings databaseSettings, java.util.Map<java.lang.String,java.lang.Object> attributes, java.util.List<java.lang.String> attachments)Initialize new client instance with BacktraceCredentialsBacktraceBase(android.content.Context context, BacktraceCredentials credentials, java.util.List<java.lang.String> attachments)Initialize new client instance with BacktraceCredentialsBacktraceBase(android.content.Context context, BacktraceCredentials credentials, java.util.Map<java.lang.String,java.lang.Object> attributes)Initialize new client instance with BacktraceCredentialsBacktraceBase(android.content.Context context, BacktraceCredentials credentials, java.util.Map<java.lang.String,java.lang.Object> attributes, java.util.List<java.lang.String> attachments)Initialize new client instance with BacktraceCredentials
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddBreadcrumb(java.lang.String message)Add a breadcrumb of type "Manual" and level "Info" with the provided message stringbooleanaddBreadcrumb(java.lang.String message, BacktraceBreadcrumbLevel level)Add a breadcrumb of type "Manual" and the desired level with the provided message stringbooleanaddBreadcrumb(java.lang.String message, BacktraceBreadcrumbType type)Add a breadcrumb of the desired type and level "Info" with the provided message stringbooleanaddBreadcrumb(java.lang.String message, BacktraceBreadcrumbType type, BacktraceBreadcrumbLevel level)Add a breadcrumb of the desired level and type with the provided message stringbooleanaddBreadcrumb(java.lang.String message, java.util.Map<java.lang.String,java.lang.Object> attributes)Add a breadcrumb of type "Manual" and level "Info" with the provided message string and attributesbooleanaddBreadcrumb(java.lang.String message, java.util.Map<java.lang.String,java.lang.Object> attributes, BacktraceBreadcrumbLevel level)Add a breadcrumb of type "Manual" and the desired level with the provided message string and attributesbooleanaddBreadcrumb(java.lang.String message, java.util.Map<java.lang.String,java.lang.Object> attributes, BacktraceBreadcrumbType type)Add a breadcrumb of the desired type and level "Info" with the provided message string and attributesbooleanaddBreadcrumb(java.lang.String message, java.util.Map<java.lang.String,java.lang.Object> attributes, BacktraceBreadcrumbType type, BacktraceBreadcrumbLevel level)Add a breadcrumb of the desired level and type with the provided message string and attributesbooleanclearBreadcrumbs()Clear breadcrumb logsvoidcrash()voiddisableNativeIntegration()voiddumpWithoutCrash(java.lang.String message)Force a native crash report and minidump submissionvoiddumpWithoutCrash(java.lang.String message, boolean setMainThreadAsFaultingThread)booleanenableBreadcrumbs(android.content.Context context)Enable logging of breadcrumbs and submission with crash reportsbooleanenableBreadcrumbs(android.content.Context context, int maxBreadcrumbLogSizeBytes)Enable logging of breadcrumbs and submission with crash reportsbooleanenableBreadcrumbs(android.content.Context context, java.util.EnumSet<BacktraceBreadcrumbType> breadcrumbTypesToEnable)Enable logging of breadcrumbs and submission with crash reportsbooleanenableBreadcrumbs(android.content.Context context, java.util.EnumSet<BacktraceBreadcrumbType> breadcrumbTypesToEnable, int maxBreadcrumbLogSizeBytes)Enable logging of breadcrumbs and submission with crash reportsvoidenableNativeIntegration()Capture unhandled native exceptions (Backtrace database integration is required to enable this feature).voidenableNativeIntegration(boolean enableClientSideUnwinding)Capture unhandled native exceptions (Backtrace database integration is required to enable this feature).voidenableNativeIntegration(boolean enableClientSideUnwinding, UnwindingMode unwindingMode)Capture unhandled native exceptions (Backtrace database integration is required to enable this feature).voidenableProguard()Inform Backtrace API that we are using Proguard symbolicationjava.util.Map<java.lang.String,java.lang.Object>getAttributes()Get custom attributesvoidnativeCrash()voidsend(BacktraceReport report)Sending an exception to Backtrace APIvoidsend(BacktraceReport report, OnServerResponseEventListener callback)Sending an exception to Backtrace APIvoidsetOnBeforeSendEventListener(OnBeforeSendEventListener eventListener)Set event executed before sending data to Backtrace APIvoidsetOnRequestHandler(RequestHandler requestHandler)Custom request handler for sending Backtrace reports to servervoidsetOnServerErrorEventListener(OnServerErrorEventListener eventListener)Set an event executed when received bad request, unauthorize request or other information from server
-
-
-
Field Detail
-
database
public final Database database
Backtrace database instance
-
version
public static java.lang.String version
Backtrace client version
-
attributes
public final java.util.Map<java.lang.String,java.lang.Object> attributes
Get custom client attributes. Every argument stored in dictionary will be send to Backtrace API
-
attachments
public final java.util.List<java.lang.String> attachments
File attachments to attach to crashes and reports.
-
metrics
public Metrics metrics
Backtrace metrics instance
-
context
protected android.content.Context context
Application context
-
-
Constructor Detail
-
BacktraceBase
public BacktraceBase(android.content.Context context, BacktraceCredentials credentials)Initialize new client instance with BacktraceCredentials- Parameters:
context- context of current state of the applicationcredentials- Backtrace credentials to access Backtrace API
-
BacktraceBase
public BacktraceBase(android.content.Context context, BacktraceCredentials credentials, java.util.List<java.lang.String> attachments)Initialize new client instance with BacktraceCredentials- Parameters:
context- context of current state of the applicationcredentials- Backtrace credentials to access Backtrace APIattachments- File attachment paths to consider for reports
-
BacktraceBase
public BacktraceBase(android.content.Context context, BacktraceCredentials credentials, java.util.Map<java.lang.String,java.lang.Object> attributes)Initialize new client instance with BacktraceCredentials- Parameters:
context- context of current state of the applicationcredentials- Backtrace credentials to access Backtrace APIattributes- additional information about current application
-
BacktraceBase
public BacktraceBase(android.content.Context context, BacktraceCredentials credentials, java.util.Map<java.lang.String,java.lang.Object> attributes, java.util.List<java.lang.String> attachments)Initialize new client instance with BacktraceCredentials- Parameters:
context- context of current state of the applicationcredentials- Backtrace credentials to access Backtrace APIattributes- additional information about current applicationattachments- File attachment paths to consider for reports
-
BacktraceBase
public BacktraceBase(android.content.Context context, BacktraceCredentials credentials, BacktraceDatabaseSettings databaseSettings)Initialize new client instance with BacktraceCredentials- Parameters:
context- context of current state of the applicationcredentials- Backtrace credentials to access Backtrace APIdatabaseSettings- Backtrace database settings
-
BacktraceBase
public BacktraceBase(android.content.Context context, BacktraceCredentials credentials, BacktraceDatabaseSettings databaseSettings, java.util.List<java.lang.String> attachments)Initialize new client instance with BacktraceCredentials- Parameters:
context- context of current state of the applicationcredentials- Backtrace credentials to access Backtrace APIdatabaseSettings- Backtrace database settingsattachments- File attachment paths to consider for reports
-
BacktraceBase
public BacktraceBase(android.content.Context context, BacktraceCredentials credentials, BacktraceDatabaseSettings databaseSettings, java.util.Map<java.lang.String,java.lang.Object> attributes)Initialize new client instance with BacktraceCredentials- Parameters:
context- context of current state of the applicationcredentials- Backtrace credentials to access Backtrace APIdatabaseSettings- Backtrace database settingsattributes- additional information about current application
-
BacktraceBase
public BacktraceBase(android.content.Context context, BacktraceCredentials credentials, BacktraceDatabaseSettings databaseSettings, java.util.Map<java.lang.String,java.lang.Object> attributes, java.util.List<java.lang.String> attachments)Initialize new client instance with BacktraceCredentials- Parameters:
context- context of current state of the applicationcredentials- Backtrace credentials to access Backtrace APIdatabaseSettings- Backtrace database settingsattributes- additional information about current applicationattachments- File attachment paths to consider for reports
-
BacktraceBase
public BacktraceBase(android.content.Context context, BacktraceCredentials credentials, Database database)Initialize new client instance with BacktraceCredentials- Parameters:
context- context of current state of the applicationcredentials- Backtrace credentials to access Backtrace APIdatabase- Backtrace database
-
BacktraceBase
public BacktraceBase(android.content.Context context, BacktraceCredentials credentials, Database database, java.util.List<java.lang.String> attachments)Initialize new client instance with BacktraceCredentials- Parameters:
context- context of current state of the applicationcredentials- Backtrace credentials to access Backtrace APIdatabase- Backtrace databaseattachments- File attachment paths to consider for reports
-
BacktraceBase
public BacktraceBase(android.content.Context context, BacktraceCredentials credentials, Database database, java.util.Map<java.lang.String,java.lang.Object> attributes)Initialize new client instance with BacktraceCredentials- Parameters:
context- context of current state of the applicationcredentials- Backtrace credentials to access Backtrace APIdatabase- Backtrace databaseattributes- additional information about current application
-
BacktraceBase
public BacktraceBase(android.content.Context context, BacktraceCredentials credentials, Database database, java.util.Map<java.lang.String,java.lang.Object> attributes, java.util.List<java.lang.String> attachments)Initialize new client instance with BacktraceCredentials- Parameters:
context- context of current state of the applicationcredentials- Backtrace credentials to access Backtrace APIdatabase- Backtrace databaseattributes- additional information about current applicationattachments- File attachment paths to consider for reports
-
-
Method Detail
-
crash
public void crash()
-
enableNativeIntegration
public void enableNativeIntegration()
Capture unhandled native exceptions (Backtrace database integration is required to enable this feature).- Specified by:
enableNativeIntegrationin interfaceClient
-
enableNativeIntegration
public void enableNativeIntegration(boolean enableClientSideUnwinding)
Capture unhandled native exceptions (Backtrace database integration is required to enable this feature).- Parameters:
enableClientSideUnwinding- Enable client side unwinding
-
enableNativeIntegration
public void enableNativeIntegration(boolean enableClientSideUnwinding, UnwindingMode unwindingMode)Capture unhandled native exceptions (Backtrace database integration is required to enable this feature).- Parameters:
enableClientSideUnwinding- Enable client side unwindingunwindingMode- Unwinding mode to use for client side unwinding
-
disableNativeIntegration
public void disableNativeIntegration()
-
enableProguard
public void enableProguard()
Inform Backtrace API that we are using Proguard symbolication
-
getAttributes
public java.util.Map<java.lang.String,java.lang.Object> getAttributes()
Get custom attributes- Returns:
- map with custom attributes
-
setOnBeforeSendEventListener
public void setOnBeforeSendEventListener(OnBeforeSendEventListener eventListener)
Set event executed before sending data to Backtrace API- Parameters:
eventListener- object with method which will be executed
-
setOnServerErrorEventListener
public void setOnServerErrorEventListener(OnServerErrorEventListener eventListener)
Set an event executed when received bad request, unauthorize request or other information from server- Parameters:
eventListener- object with method which will be executed
-
setOnRequestHandler
public void setOnRequestHandler(RequestHandler requestHandler)
Custom request handler for sending Backtrace reports to server- Parameters:
requestHandler- object with method which will be executed
-
enableBreadcrumbs
public boolean enableBreadcrumbs(android.content.Context context)
Enable logging of breadcrumbs and submission with crash reports- Parameters:
context- context of current state of the application- Returns:
- true if we successfully enabled breadcrumbs
-
enableBreadcrumbs
public boolean enableBreadcrumbs(android.content.Context context, int maxBreadcrumbLogSizeBytes)Enable logging of breadcrumbs and submission with crash reports- Parameters:
context- context of current state of the applicationmaxBreadcrumbLogSizeBytes- breadcrumb log size limit in bytes, should be a power of 2- Returns:
- true if we successfully enabled breadcrumbs
-
enableBreadcrumbs
public boolean enableBreadcrumbs(android.content.Context context, java.util.EnumSet<BacktraceBreadcrumbType> breadcrumbTypesToEnable)Enable logging of breadcrumbs and submission with crash reports- Parameters:
context- context of current state of the applicationbreadcrumbTypesToEnable- a set containing which breadcrumb types to enable- Returns:
- true if we successfully enabled breadcrumbs
-
enableBreadcrumbs
public boolean enableBreadcrumbs(android.content.Context context, java.util.EnumSet<BacktraceBreadcrumbType> breadcrumbTypesToEnable, int maxBreadcrumbLogSizeBytes)Enable logging of breadcrumbs and submission with crash reports- Parameters:
context- context of current state of the applicationbreadcrumbTypesToEnable- a set containing which breadcrumb types to enablemaxBreadcrumbLogSizeBytes- breadcrumb log size limit in bytes, should be a power of 2- Returns:
- true if we successfully enabled breadcrumbs
-
clearBreadcrumbs
public boolean clearBreadcrumbs()
Clear breadcrumb logs
-
addBreadcrumb
public boolean addBreadcrumb(java.lang.String message)
Add a breadcrumb of type "Manual" and level "Info" with the provided message string- Parameters:
message- a message which describes this breadcrumb (1KB max)- Returns:
- true if the breadcrumb was successfully added
-
addBreadcrumb
public boolean addBreadcrumb(java.lang.String message, BacktraceBreadcrumbLevel level)Add a breadcrumb of type "Manual" and the desired level with the provided message string- Parameters:
message- a message which describes this breadcrumb (1KB max)level- the severity level of this breadcrumb- Returns:
- true if the breadcrumb was successfully added
-
addBreadcrumb
public boolean addBreadcrumb(java.lang.String message, java.util.Map<java.lang.String,java.lang.Object> attributes)Add a breadcrumb of type "Manual" and level "Info" with the provided message string and attributes- Parameters:
message- a message which describes this breadcrumb (1KB max)attributes- key-value pairs to provide additional information about this breadcrumb (1KB max, including some overhead per key-value pair)- Returns:
- true if the breadcrumb was successfully added
-
addBreadcrumb
public boolean addBreadcrumb(java.lang.String message, java.util.Map<java.lang.String,java.lang.Object> attributes, BacktraceBreadcrumbLevel level)Add a breadcrumb of type "Manual" and the desired level with the provided message string and attributes- Parameters:
message- a message which describes this breadcrumb (1KB max)attributes- key-value pairs to provide additional information about this breadcrumb (1KB max, including some overhead per key-value pair)level- the severity level of this breadcrumb- Returns:
- true if the breadcrumb was successfully added
-
addBreadcrumb
public boolean addBreadcrumb(java.lang.String message, BacktraceBreadcrumbType type)Add a breadcrumb of the desired type and level "Info" with the provided message string- Parameters:
message- a message which describes this breadcrumb (1KB max)type- broadly describes the category of this breadcrumb- Returns:
- true if the breadcrumb was successfully added
-
addBreadcrumb
public boolean addBreadcrumb(java.lang.String message, BacktraceBreadcrumbType type, BacktraceBreadcrumbLevel level)Add a breadcrumb of the desired level and type with the provided message string- Parameters:
message- a message which describes this breadcrumb (1KB max)type- broadly describes the category of this breadcrumblevel- the severity level of this breadcrumb- Returns:
- true if the breadcrumb was successfully added
-
addBreadcrumb
public boolean addBreadcrumb(java.lang.String message, java.util.Map<java.lang.String,java.lang.Object> attributes, BacktraceBreadcrumbType type)Add a breadcrumb of the desired type and level "Info" with the provided message string and attributes- Parameters:
message- a message which describes this breadcrumb (1KB max)attributes- key-value pairs to provide additional information about this breadcrumb (1KB max, including some overhead per key-value pair)type- broadly describes the category of this breadcrumb- Returns:
- true if the breadcrumb was successfully added
-
addBreadcrumb
public boolean addBreadcrumb(java.lang.String message, java.util.Map<java.lang.String,java.lang.Object> attributes, BacktraceBreadcrumbType type, BacktraceBreadcrumbLevel level)Add a breadcrumb of the desired level and type with the provided message string and attributes- Parameters:
message- a message which describes this breadcrumb (1KB max)attributes- key-value pairs to provide additional information about this breadcrumb (1KB max, including some overhead per key-value pair)type- broadly describes the category of this breadcrumblevel- the severity level of this breadcrumb- Returns:
- true if the breadcrumb was successfully added
-
nativeCrash
public void nativeCrash()
-
dumpWithoutCrash
public void dumpWithoutCrash(java.lang.String message)
Force a native crash report and minidump submission- Parameters:
message-
-
dumpWithoutCrash
public void dumpWithoutCrash(java.lang.String message, boolean setMainThreadAsFaultingThread)
-
send
public void send(BacktraceReport report)
Sending an exception to Backtrace API
-
send
public void send(BacktraceReport report, OnServerResponseEventListener callback)
Sending an exception to Backtrace API- Parameters:
report- current BacktraceReport
-
-