Android SDK
v0.5.0Integrate BugScreen into your Android app in minutes. Kotlin, Jetpack Compose, Gradle.
Installation
BugScreen is published to Maven Central. Make sure mavenCentral() is in your repositories list (typically in settings.gradle.kts):
dependencyResolutionManagement {
repositories {
mavenCentral()
}
}Then add the dependency to your module's build.gradle.kts:
dependencies {
implementation("app.bugscreen:android:0.5.0")
}Setup
Initialize BugScreen in your Application class:
class MyApp : Application() {
override fun onCreate() {
super.onCreate()
BugScreenSDK.start(
BugScreenConfig.Builder(this)
.apiKey("fb_your_api_key_here")
.enableScreenshotDetection(true)
.enableSdkLogging(BuildConfig.DEBUG)
.build()
)
}
}Request permissions
For screenshot detection to work on Android 13 and below, you need to request the appropriate permission. Android 14+ doesn't require any permission to detect screenshots — but if you want the SDK to auto-attach the screenshot to the report, it will prompt the user for photo access the first time. If they decline, the user simply picks the screenshot from the photo picker instead. The SDK provides helper functions to simplify the detection-side permission.
Simple approach (recommended)
Use the SDK's built-in permission request function:
// Check if permission is needed
if (BugScreenSDK.shouldRequestPermission(this)) {
// Request permission with callback
BugScreenSDK.requestScreenshotPermission(this) { granted ->
if (granted) {
// Permission granted - screenshot detection enabled
} else {
// Permission denied - manual triggering still works
}
}
}
// Or just check permission status
val hasPermission = BugScreenSDK.hasScreenshotPermission(this)Advanced approach
For custom permission UI, get the required permission string:
// Get version-specific permission (null on Android 14+)
val permission = BugScreenSDK.getRequiredPermission()
if (permission != null) {
// Use Android's permission request APIs
requestPermissions(arrayOf(permission), REQUEST_CODE)
}Usage
Automatic screenshot detection
When users take a screenshot, BugScreen automatically shows a bug report dialog. That's it.
Manual triggering
Open the bug report screen programmatically:
// Without screenshot
BugScreenSDK.openBugReportScreen(context)
// With screenshot
BugScreenSDK.openBugReportScreen(context, screenshotUri)Logging
Add context to bug reports with application logs:
BugScreenSDK.log(LogLevel.INFO, "User tapped checkout button")
BugScreenSDK.log(LogLevel.ERROR, "Payment failed: ${error.message}")Logs are automatically included with every bug report.
Configuration
| Option | Default | Description |
|---|---|---|
| apiKey(String) | Required | Your API key from the BugScreen console |
| enableScreenshotDetection(Boolean) | true | Auto-detect screenshots and show report UI |
| enableSdkLogging(Boolean) | false | Enable debug logs (use BuildConfig.DEBUG) |
What gets collected?
BugScreen automatically collects this information with each report:
- •Device model & manufacturer
- •Android version & API level
- •App version & package name
- •Screen resolution & density
- •Screen size (dp)
- •Memory (total & available)
- •Device locale
- •BugScreen SDK version
Ready to get started?
Create an account to get your API key.