Create extension function to see if package is installed

This commit is contained in:
moezbhatti
2019-05-29 17:46:51 -04:00
parent 3bc4b86fea
commit 5883f661ff
2 changed files with 12 additions and 7 deletions
@@ -72,4 +72,8 @@ fun Activity.dismissKeyboard() {
focus.clearFocus()
}
}
}
fun Context.isInstalled(packageName: String): Boolean {
return tryOrNull(false) { packageManager.getApplicationInfo(packageName, 0).enabled } ?: false
}