Appium - Take Screen Shot in Appium

import org.openqa.selenium.TakesScreenshot;
import java.io.File;
import org.apache.commons.io.FileUtils;

public static void takeScreenShot(String imageName) {
         
          String destinationDir = "screenshots";
         
          File scrFile = ((TakesScreenshot) AndroidDriverManager.getDriver()).getScreenshotAs(OutputType.FILE);
         
          new File(destinationDir).mkdirs();
         
          String destFile = imageName + ".png";

          try {
         
           FileUtils.copyFile(scrFile, new File(destinationDir + "/" + destFile));
           
          } catch (IOException e) {
           e.printStackTrace();
          }
         }