How to check whether Android app already installed or not?
Simply use this method. Provide your package name as an argument and it will give you “true” if the application is already installed else “false”. (only applicable on pCloudy)
Code Snippet:
private boolean isMyAppInstalled(String packageName) { String value = driver.executeScript("pCloudy_executeAdbCommand", "adb shell pm list packages").toString(); return Arrays.stream(value.split("\n")).anyMatch(p -> p.equalsIgnoreCase("package:" + packageName)); }