Android SDK
Integrate BugScreen into your Android app in minutes
Installation
Coming Soon
Maven coordinates will be available shortly. Check back soon for installation instructions.
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+ does not require runtime permissions. The SDK provides helper functions to simplify this:
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)
}Note: Android 14+ doesn't require runtime permissions for screenshot detection. The SDK automatically handles version differences.
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 device and app information with each report:
- •Device model & manufacturer
- •Android version & API level
- •App version & package name
- •Screen resolution & density
- •Memory (total & available)
- •Device locale