Client

open class Client : MetadataAware, CallbackAware, UserAware, FeatureFlagAware

A Bugsnag Client instance allows you to use Bugsnag in your Android app. Typically you'd instead use the static access provided in the Bugsnag class.

Example usage: Client client = new Client(this, "your-api-key"); client.notify(new RuntimeException("something broke!"));

See also

Constructors

Link copied to clipboard
constructor(@NonNull androidContext: Context)
Initialize a Bugsnag client
constructor(@NonNull androidContext: Context, @NonNull apiKey: String)
Initialize a Bugsnag client
constructor(@NonNull androidContext: Context, @NonNull configuration: Configuration)
Initialize a Bugsnag client

Properties

Link copied to clipboard

Functions

Link copied to clipboard
open fun addFeatureFlag(@NonNull name: String)
Add a single feature flag with no variant.
open fun addFeatureFlag(@NonNull name: String, @Nullable variant: String)
Add a single feature flag with an optional variant.
Link copied to clipboard
open fun addFeatureFlags(@NonNull featureFlags: Iterable<FeatureFlag>)
Add a collection of feature flags.
Link copied to clipboard
open fun addMetadata(@NonNull section: String, @NonNull value: Map<String, out Any>)
Adds a map of multiple metadata key-value pairs to the specified section.
open fun addMetadata(@NonNull section: String, @NonNull key: String, @Nullable value: Any)
Adds the specified key and value in the specified section.
Link copied to clipboard
open fun addOnBreadcrumb(@NonNull onBreadcrumb: OnBreadcrumbCallback)
Add an "on breadcrumb" callback, to execute code before every breadcrumb captured by Bugsnag.
Link copied to clipboard
open fun addOnError(@NonNull onError: OnErrorCallback)
Add a "on error" callback, to execute code at the point where an error report is captured in Bugsnag.
Link copied to clipboard
open fun addOnSession(@NonNull onSession: OnSessionCallback)
Add an "on session" callback, to execute code before every session captured by Bugsnag.
Link copied to clipboard
open fun clearFeatureFlag(@NonNull name: String)
Remove a single feature flag regardless of its current status.
Link copied to clipboard
Clear all of the feature flags.
Link copied to clipboard
open fun clearMetadata(@NonNull section: String)
Removes all the data from the specified section.
open fun clearMetadata(@NonNull section: String, @NonNull key: String)
Removes data with the specified key from the specified section.
Link copied to clipboard
Returns the current buffer of breadcrumbs that will be sent with captured events.
Link copied to clipboard
Bugsnag uses the concept of "contexts" to help display and group your errors.
Link copied to clipboard
open fun getMetadata(@NonNull section: String): Map<String, Any>
Returns a map of data in the specified section.
open fun getMetadata(@NonNull section: String, @NonNull key: String): Any
Returns the value of the specified key in the specified section.
Link copied to clipboard
open fun getUser(): User
Returns the currently set User information.
Link copied to clipboard
open fun leaveBreadcrumb(@NonNull message: String)
Leave a "breadcrumb" log message, representing an action that occurred in your app, to aid with debugging.
open fun leaveBreadcrumb(@NonNull message: String, @NonNull metadata: Map<String, Any>, @NonNull type: BreadcrumbType)
Leave a "breadcrumb" log message representing an action or event which occurred in your app, to aid with debugging
Link copied to clipboard
Informs Bugsnag that the application has finished launching.
Link copied to clipboard
open fun notify(@NonNull exception: Throwable)
open fun notify(@NonNull exc: Throwable, @Nullable onError: OnErrorCallback)
Notify Bugsnag of a handled exception
Link copied to clipboard
open fun pauseSession()
Pauses tracking of a session.
Link copied to clipboard
Removes a previously added "on breadcrumb" callback
Link copied to clipboard
Removes a previously added "on error" callback
Link copied to clipboard
Removes a previously added "on session" callback
Link copied to clipboard
Resumes a session which has previously been paused, or starts a new session if none exists.
Link copied to clipboard
open fun setContext(@Nullable context: String)
Bugsnag uses the concept of "contexts" to help display and group your errors.
Link copied to clipboard
open fun setUser(@Nullable id: String, @Nullable email: String, @Nullable name: String)
Sets the user associated with the event.
Link copied to clipboard
open fun startSession()
Starts tracking a new session.