From 93abe620bd7878a331d94716a71aea0284175766 Mon Sep 17 00:00:00 2001 From: Denis Sheikherev Date: Wed, 25 Nov 2026 17:40:34 +0700 Subject: [PATCH 1/3] docs(android): upload a created report from setScreenshotAsync's callback Report.setScreenshot encodes and writes the image on the calling thread, and the createReport listener runs on the main thread. A report uploaded right after setScreenshotAsync can be sent without the new screenshot. "Programmatic report creation" now lists setScreenshotAsync and shows uploading from its callback (bugsee/bugsee-android#851). Co-Authored-By: Claude Opus 5.5 --- docs/sdk/android/manual/bug-reporting.mdx | 36 +++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/docs/sdk/android/manual/bug-reporting.mdx b/docs/sdk/android/manual/bug-reporting.mdx index 7cbedad..027a2e0 100644 --- a/docs/sdk/android/manual/bug-reporting.mdx +++ b/docs/sdk/android/manual/bug-reporting.mdx @@ -182,6 +182,7 @@ The `Report` you receive is mutable. The most commonly used members: - `setSeverity(IssueSeverity)` — one of `VeryLow`, `Medium`, `High`, `Critical`, `Blocker`. - `addLabel(String)` / `addLabels(List)` / `setLabels(List)` / `clearLabels()` — dashboard labels. - `getAttachments()` returns the current `List`; `createAndAddAttachment(name)` adds a new one (see [Attachments](/sdk/android/report-handler#attachments)). +- `setScreenshotAsync(Bitmap, Runnable)` — replaces the screenshot; see [Replacing the screenshot](#replacing-the-screenshot) for when to upload. The same `Report` is what `ReportHandler.onBeforeReportCreated(...)` / `onAfterReportCreated(...)` hands you, so the same mutators apply there. @@ -216,6 +217,41 @@ Bugsee.createReport { report -> +### Replacing the screenshot + +`setScreenshot(Bitmap)` encodes the image and writes it to disk on the calling thread. For a screen-sized bitmap that takes over 100 ms, and `onCreated` runs on the main thread. Use `setScreenshotAsync(Bitmap, Runnable)` there, and upload the report from its callback: + +- `setScreenshotAsync` returns before the screenshot is stored, and calls the callback once it is. +- A report uploaded before that can be sent without the new screenshot, so do not call `Bugsee.upload(report)` right after `setScreenshotAsync`. +- The callback runs on the thread that called `setScreenshotAsync` when that thread has a `Looper` (here, the main thread), otherwise on the main thread. + + + + +```java +Bugsee.createReport(report -> { + if (report == null) { + return; // SDK not launched, or creation failed + } + report.setSummary("Checkout frozen"); + report.setScreenshotAsync(bitmap, () -> Bugsee.upload(report)); +}); +``` + + + + +```kotlin +Bugsee.createReport { report -> + report ?: return@createReport // SDK not launched, or creation failed + report.summary = "Checkout frozen" + report.setScreenshotAsync(bitmap) { Bugsee.upload(report) } +} +``` + + + + ## Severity values `IssueSeverity` values: `VeryLow`, `Medium`, `High`, `Critical`, `Blocker`. See the [configuration reference — Enums](/sdk/android/configuration#enum-reference) for each value's meaning. From ad7265e25ac0023ea00e24d14af60e25c8f65e07 Mon Sep 17 00:00:00 2001 From: Denis Sheikherev Date: Wed, 25 Nov 2026 17:49:58 +0700 Subject: [PATCH 2/3] docs(android): list setScreenshot next to setScreenshotAsync The list of commonly used Report members named only the asynchronous call. It now names both and says how they differ. Co-Authored-By: Claude Opus 5.5 --- docs/sdk/android/manual/bug-reporting.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sdk/android/manual/bug-reporting.mdx b/docs/sdk/android/manual/bug-reporting.mdx index 027a2e0..6fb5dbb 100644 --- a/docs/sdk/android/manual/bug-reporting.mdx +++ b/docs/sdk/android/manual/bug-reporting.mdx @@ -182,7 +182,7 @@ The `Report` you receive is mutable. The most commonly used members: - `setSeverity(IssueSeverity)` — one of `VeryLow`, `Medium`, `High`, `Critical`, `Blocker`. - `addLabel(String)` / `addLabels(List)` / `setLabels(List)` / `clearLabels()` — dashboard labels. - `getAttachments()` returns the current `List`; `createAndAddAttachment(name)` adds a new one (see [Attachments](/sdk/android/report-handler#attachments)). -- `setScreenshotAsync(Bitmap, Runnable)` — replaces the screenshot; see [Replacing the screenshot](#replacing-the-screenshot) for when to upload. +- `setScreenshot(Bitmap)` / `setScreenshotAsync(Bitmap, Runnable)` — replace the screenshot. `setScreenshot` encodes and writes the image on the calling thread; `setScreenshotAsync` does it in the background and calls the `Runnable` once the screenshot is stored. See [Replacing the screenshot](#replacing-the-screenshot) for which one to use in `onCreated` and when to upload. The same `Report` is what `ReportHandler.onBeforeReportCreated(...)` / `onAfterReportCreated(...)` hands you, so the same mutators apply there. From e56e32138887a311897441229f7a7acbccc4959c Mon Sep 17 00:00:00 2001 From: Denis Sheikherev Date: Wed, 25 Nov 2026 18:00:09 +0700 Subject: [PATCH 3/3] docs(android): show where the screenshot bitmap comes from, and who owns it The examples used an undeclared `bitmap`. They now produce it, and the section says that setScreenshotAsync reads the bitmap on a background thread without copying it, so it must not be recycled or changed until the callback runs (Report.java:360-361 at SDK v7.6.0). Co-Authored-By: Claude Opus 5.5 --- docs/sdk/android/manual/bug-reporting.mdx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/sdk/android/manual/bug-reporting.mdx b/docs/sdk/android/manual/bug-reporting.mdx index 6fb5dbb..8028301 100644 --- a/docs/sdk/android/manual/bug-reporting.mdx +++ b/docs/sdk/android/manual/bug-reporting.mdx @@ -224,6 +224,7 @@ Bugsee.createReport { report -> - `setScreenshotAsync` returns before the screenshot is stored, and calls the callback once it is. - A report uploaded before that can be sent without the new screenshot, so do not call `Bugsee.upload(report)` right after `setScreenshotAsync`. - The callback runs on the thread that called `setScreenshotAsync` when that thread has a `Looper` (here, the main thread), otherwise on the main thread. +- The SDK reads the bitmap on a background thread after the call returns, and does not copy it, so do not recycle or change the bitmap until the callback runs. The report neither keeps nor recycles it: after the callback the bitmap is yours again. @@ -233,6 +234,7 @@ Bugsee.createReport(report -> { if (report == null) { return; // SDK not launched, or creation failed } + Bitmap bitmap = renderCheckoutScreen(); // a Bitmap your app produces report.setSummary("Checkout frozen"); report.setScreenshotAsync(bitmap, () -> Bugsee.upload(report)); }); @@ -244,6 +246,7 @@ Bugsee.createReport(report -> { ```kotlin Bugsee.createReport { report -> report ?: return@createReport // SDK not launched, or creation failed + val bitmap = renderCheckoutScreen() // a Bitmap your app produces report.summary = "Checkout frozen" report.setScreenshotAsync(bitmap) { Bugsee.upload(report) } }