I am using Android AccessibilityService to take screenshot using some method that has been added on api level 30 , I wonder to know if it works on api's lower than 30 or not
this is my overrided method
@Override
public void takeScreenshot(int displayId, @NonNull Executor executor, @NonNull TakeScreenshotCallback callback) {
super.takeScreenshot(displayId, executor, callback);
}
and this is where I call takeScreenshot method and it gives me the result by takeScreenshot CallBack
takeScreenshot(Display.DEFAULT_DISPLAY,
getApplicationContext().getMainExecutor(), new TakeScreenshotCallback() {
@RequiresApi(api = Build.VERSION_CODES.R)
@Override
public void onSuccess(@NonNull ScreenshotResult screenshotResult) {
Log.i("ScreenShotResult","onSuccess");
Bitmap bitmap = Bitmap.wrapHardwareBuffer(screenshotResult.getHardwareBuffer(),screenshotResult.getColorSpace());
AccessibilityUtils.saveImage(bitmap,getApplicationContext(),"WhatsappIntegration");
}
@Override
public void onFailure(int i) {
Log.i("ScreenShotResult","onFailure code is "+ i);
}
});
