Check if an app is installed, and get it's version in Sketchware

We can check if an app is installed or not by using it's package name in simple codes in Sketchware.

Check if an app is installed or not



We can get information about any installed app from it's package name, by using PackageManager and PackageInfo methods. PackageInfo provides Overall information about the contents of a package. This corresponds to all the information collected from AndroidManifest.xml.


In onCreate event in LOGIC of your app, use an add source directly block and add following code:


boolean isAppInstalled = appInstalledOrNot("com.besome.sketch");


if(isAppInstalled) {

showMessage("Sketchware app is installed");

} else {showMessage("Sketchware is not installed");}}



private boolean appInstalledOrNot(String uri) { android.content.pm.PackageManager pm = getPackageManager(); try { pm.getPackageInfo(uri, android.content.pm.PackageManager.GET_ACTIVITIES); return true; } catch (android.content.pm.PackageManager.NameNotFoundException e) { } return false;

The code above will check if Sketchware App is installed or not. And show message if it is installed or not on activity create.




Note that underlined text com.besome.sketch is package name of Sketchware. To check for any other app, use it's package name in that place.





To perform ant other action instead of showing message, replace the code in italics with codes or blocks for action you want to perform.