Keycode to press the minimized android app

Here is my requirement:

I want to test the switch functionality the step I am following is:

1- Opened my android app.
2- Fill some value.
3- Now clicked on ((AndroidDriver)driver).pressKeyCode(AndroidKeyCode.KEYCODE_APP_SWITCH);
4- Now I should click on any previously opened app (I can do this by taking the xpath of android system driver.findElements(By.id(“com.android.systemui:id/app_thumbnail_image”))) but the problem is it is different in each devices.
Here I want to click on any other previously open app by using android KEYCODE. I dont get any keycode for this. Please suggest me if anyone has done this.