Added in API level 30

AccessibilityService.TakeScreenshotCallback


public static interface AccessibilityService.TakeScreenshotCallback

android.accessibilityservice.AccessibilityService.TakeScreenshotCallback


Interface used to report status of taking screenshot.

Summary

Public methods

abstract void onFailure(int errorCode)

Called when taking screenshot has failed.

abstract void onSuccess(AccessibilityService.ScreenshotResult screenshot)

Called when taking screenshot has completed successfully.

Public methods

onFailure

Added in API level 30
public abstract void onFailure (int errorCode)

Called when taking screenshot has failed. errorCode will identify the reason of failure.

Parameters
errorCode int: The error code of this operation. Value is AccessibilityService.ERROR_TAKE_SCREENSHOT_INTERNAL_ERROR, AccessibilityService.ERROR_TAKE_SCREENSHOT_NO_ACCESSIBILITY_ACCESS, AccessibilityService.ERROR_TAKE_SCREENSHOT_INTERVAL_TIME_SHORT, AccessibilityService.ERROR_TAKE_SCREENSHOT_INVALID_DISPLAY, or AccessibilityService.ERROR_TAKE_SCREENSHOT_INVALID_WINDOW

onSuccess

Added in API level 30
public abstract void onSuccess (AccessibilityService.ScreenshotResult screenshot)

Called when taking screenshot has completed successfully.

Parameters
screenshot AccessibilityService.ScreenshotResult: The content of screenshot. This value cannot be null.