Anyway to automate passcode in android apps using appium

Hi,
I have a scenario to automate the passcode in Android App. please find the attached screenshot for more details.

So I am unable to automate the passcode, becuase keyboard elements are not identified by UIAutomator.

We have used below code to automate in the Local Devices & Emulators,but it won’t work in cloud devices(Robot class will work only if the keyboard is in foucs only).

Method:
public void enterPasscode(){
try{
List pass = getDriver().findElement(By.id(“boxContainer”)).findElements(By.xpath("//android.widget.RelativeLayout"));
Robot robot=new Robot();
for (int i=0;i<pass.size();i++) {
WebElement passselect = pass.get(i);
passselect.click();
robot.keyPress(KeyEvent.VK_1);
robot.keyRelease(KeyEvent.VK_1);
}
}catch(Exception e){
getRep().reportinCatch(e);
}
}

Did you tried pressKeyCode() method?

Try below may work:

((AndroidDriver) driver).pressKeyCode(AndroidKeyCode.KEYCODE_1);