How to check whether Android app already installed or not? – pCloudy – Question and Answers
Home >> Appium Tricks and Tricks >> How to check whether Android app already ...

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));
}

Leave a Reply

Your email address will not be published. Required fields are marked *