requestScreenshotPermission

fun requestScreenshotPermission(activity: ComponentActivity, callback: (granted: Boolean) -> Unit)

Request the screenshot detection permission from the user.

This is a convenience method that handles the entire permission request flow. On Android 14+, it immediately returns true (no permission needed). On older versions, it shows the system permission dialog.

Note: This method launches a transparent activity to handle the permission request. The callback will be invoked with the result after the user responds to the dialog.

Parameters

activity

The activity to request permission from

callback

Callback invoked with true if permission granted, false if denied

Example:

BugScreenSDK.requestScreenshotPermission(this) { granted ->
if (granted) {
Toast.makeText(this, "Permission granted!", Toast.LENGTH_SHORT).show()
} else {
Toast.makeText(this, "Permission denied", Toast.LENGTH_SHORT).show()
}
}