Hello all,
I was working on a method to close an Android app from the app drawer. Simulating how a user would hard close an app (I found terminateApp was causing issues with the webview in the app). I have the below which does what I need (opens recent apps and swipes up…important)
driver.executeScript("mobile: pressKey", Map.of(
"keycode", 187 // https://developer.android.com/reference/android/view/KeyEvent#KEYCODE_RECENT_APPS
));
int height = driver.manage().window().getSize().getHeight();
int width = driver.manage().window().getSize().getWidth();
((JavascriptExecutor) driver).executeScript("mobile: flingGesture", ImmutableMap.of(
"left", 0,
"top", height / 3,
"width", width,
"height", height / 3,
**"direction", "down",**
"speed", 7500
));
As you can see, it only works when I select down. Conversely, using up will provide down actions (e.g. swiping down from the notification bar). Is this intentional? It appears to alwasy have been like this, so I’m assuming I’m missing something, but to me it’s clearly reversed.