Below 30 API there were two methods I could use to check if intent can be handled by some app activity:
fun Intent.canBeHandled(packageManager: PackageManager): Boolean {
return resolveActivity(packageManager) != null
}
fun PackageManager.isIntentCanBeHandled(intent: Intent): Boolean {
val infos = queryIntentActivities(intent, 0)
return infos.isNotEmpty()
}
But when I test on Pixel 3 API 30 Emulator it doesn't work as expected, e.g. queryIntentActivities() returns usually 0 or 1 (e.g. 1 for send intent when it should have been 7, as it was with API 29-)
Basically Intent.createChooser(intent, "") works correctly and suggests 2 apps (for example) but ext funcs Intent.canBeHandled() & PackageManager.isIntentCanBeHandled() return false