You can use Intent.resolveActivity
before launching the app. Something like:
if (yourIntent.resolveActivity(getPackageManager()) != null) {
startActivity(yourIntent);
}
To check if the app is enabled, you can use PackageManager.getApplicationInfo
.
ApplicationInfo ai = getPackageManager().getApplicationInfo("com.google.android.gm", 0);
// ai.enabled will return `true` if it's enabled and `false` otherwise