Taking screenshots in Appium when it's failure

Hi all,

I’m using Appium+POM+Serenity . I wanna take screenshot only for failed steps.
So I have mentioned below in Appium page object class(common class for general page methods)
public static void getScreenshot(AndroidDriver driver, String outputlocation ) throws IOException {
System.out.println(“Capturing the snapshot of the page “);
File srcFiler=((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(srcFiler, new File(outputlocation));
}
And calling those methods from step class
@Step
public void isBtnAvailable(String btnName) throws InterruptedException {
boolean isAvailable = accountPage.verify_Btn(btnName);
Thread.sleep(5000);
Assert.assertTrue(isAvailable);
getScreenshot(driver,”/Users/local/downloads”);

}

but driver in above code shows compile error? Can anybody explain where i have to put correct code and how to call that?