Сan we open the facebook link so that the menu selection of applications for viewing the content was still and facebook browsers? The standard startup
fun openLink(link: String) {
Intent(Intent.ACTION_VIEW).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK
data = Uri.parse(link)
context.startActivity( this)
}
}
opens only browsers, and some browsers, such as chrome and edge, run another one, where then appears facebook (if it is installed), the only thing I was able to find was to open the links directly to facebook, if it is installed, without the possibility of choosing an application to open the link
Intent(Intent.ACTION_VIEW).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK
try {
val applicationInfo: ApplicationInfo =
packageManager.getApplicationInfo("com.facebook.katana", 0)
if (applicationInfo.enabled) {
// http://stackoverflow.com/a/24547437/1048340
data = Uri.parse("fb://facewebmodal/f?href=https://facebook.com/")
}
} catch (ignored: PackageManager.NameNotFoundException) {
data = Uri.parse("https://facebook.com/")
}
startActivity(this)
}