BugScreenSDK

Main SDK class for BugScreen

Initialize in your Application class:

class MyApp : Application() {
override fun onCreate() {
super.onCreate()
BugScreenSDK.start(
BugScreenConfig.Builder(this)
.apiKey("fb_your_api_key")
.screenshotDetection(true)
.debug(BuildConfig.DEBUG)
.build()
)
}
}

Properties

Link copied to clipboard

Check if SDK is initialized

Functions

Link copied to clipboard

Merge data into the existing custom data map. Keys in data overwrite existing values; keys not in data are preserved. The provided map is defensively copied.

Link copied to clipboard

Clear any custom data previously set via setCustomData.

Link copied to clipboard

Clear any account set via setUser or setUserProvider. Subsequent reports carry no account until one is set again.

Link copied to clipboard

Get the permission string required for screenshot detection on this device.

Link copied to clipboard

Check if the app has the required permission for screenshot detection.

Link copied to clipboard
fun log(level: LogLevel, message: String)

Log a message that will be included in bug reports. Logs are stored in memory (max 1MB) and sent with bug report submissions.

Link copied to clipboard
fun openBugReportScreen(context: Context, screenshotUri: Uri? = null)

Open the bug report screen.

Link copied to clipboard

Remove a single custom data key from the global map. No-op if key is not present. Other keys are preserved.

Link copied to clipboard
fun requestScreenshotPermission(activity: ComponentActivity, callback: (granted: Boolean) -> Unit)

Request the screenshot detection permission from the user.

Link copied to clipboard

Attach a global map of custom key/value pairs to every subsequent bug report.

Set a single custom data key/value pair on the global map sent with every subsequent bug report. Overwrites the existing value for key if any; other keys are preserved.

Link copied to clipboard
fun setUser(id: String, role: String? = null, email: String? = null)

Identify the account the report is filed under. The reporter's login is the first thing a triager needs to reproduce a bug, so the backend renders it as a dedicated Account section at the top of the created issue and promotes role to a filterable label.

Link copied to clipboard
fun setUserProvider(provider: () -> BugScreenUser??)

Supply the account lazily. The provider is invoked at capture time (when the report screen opens), not when you register it — so the attached account always reflects the current session and never a stale value from a previous login. This is the primitive setUser is sugar over; registering a provider clears any static user previously set.

Link copied to clipboard

Check if the app should request screenshot detection permission from the user.

Link copied to clipboard

Shutdown the SDK and release resources

Link copied to clipboard

Start the SDK with the given configuration