We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fe53099 commit 9adfc50Copy full SHA for 9adfc50
app/src/main/java/com/kylecorry/trailsensecore/infrastructure/system/PackageUtils.kt
@@ -1,6 +1,7 @@
1
package com.kylecorry.trailsensecore.infrastructure.system
2
3
import android.content.Context
4
+import android.content.pm.PackageManager
5
6
object PackageUtils {
7
@@ -13,4 +14,13 @@ object PackageUtils {
13
14
return packageManager.getPackageInfo(getPackageName(context), 0).versionName
15
}
16
17
+ fun isPackageInstalled(context: Context, packageName: String): Boolean {
18
+ return try {
19
+ context.packageManager.getPackageInfo(packageName, 0)
20
+ true
21
+ } catch (e: PackageManager.NameNotFoundException) {
22
+ false
23
+ }
24
25
+
26
0 commit comments