Issue
To Check if a package is installed in android Kotlin programmatically for android 12+. Without declaring a query in the manifest file for Android 12+(API 31+).
Solution
private fun isAvailable(ctx: Context, intent: Intent?): Boolean {
val mgr = ctx.packageManager
val list = mgr.queryIntentActivities(intent!!, PackageManager.MATCH_DEFAULT_ONLY)
return list.size > 0
}
Use this code snippet for that, Thanks.
Answered By - Udit Bhaskar
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.