Declare Query Request for Package
xml
<queries>
<package android:name="com.tencent.mm" />
<package android:name="com.xingin.xhs" />
</queries>
Query Install State
kotlin
fun Context.isPackageInstalled(packageName: String): Boolean {
try {
packageManager.getApplicationInfo(packageName, 0)
return true
} catch (e: Throwable) {
return false
}
}