I have following code taken from How get list of web browsers in system supposed to return all browsers installed on a device.
This does not raise any error but browsersList
size is zero on any AVD while works as expected on a real smart phone.
What am I missing?
Edit
Tested AVDs
Android 11 - DOESN'T WORK
Android 10 - Works
Tested Actual Devices
Android 10 - Works
Android 9 - Works
Android 8 - Works
Since I don't have an actual device with Android 11 not sure if the v11 is the problem. But it seems so.
val packageManager: PackageManager = this.getPackageManager()
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse("http://www.aurl.com"))
val browsersList = packageManager.queryIntentActivities(
browserIntent,
PackageManager.MATCH_ALL
)
browsersList.forEach {
val packageName = it.activityInfo.packageName
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…