On Android 10, I can open PDF http link with CustomTabsIntent (it redirect to Drive PDF Viewer) but on Android 12 Beta (on Android Virtual Device) it always show download dialog:
val uri = Uri.parse("http://www.africau.edu/images/default/sample.pdf")
customTabsIntent.launchUrl(mContext, uri) // works on Android 10
It seems that it related to Android 12 Web intent resolution (https://developer.android.com/about/versions/12/web-intent-resolution#request-user-associate-app-with-domain); maybe Chrome which not verified with domain URL and cannot resolve Intent?
How can I make it open PDF though on Android 12?
you can open pdf using google doc :
val customTabsIntent = CustomTabsIntent.Builder().build()
val uri = Uri.parse("https://docs.google.com/gview?embedded=true&url=http://www.africau.edu/images/default/sample.pdf")
customTabsIntent.launchUrl(this, uri)
add this to your url : https://docs.google.com/gview?embedded=true&url=