'Android facebook share opens web page instead of native app

I am using Facebook share SDK and I read the docs which says that if the native Facebook app is installed then it will be used as a share dialog otherwise a web page will be used for sharing. I do have Facebook installed on my device (Xiaomi POCO F2 PRO) and it only opens the web page version for sharing.. any suggestions?

my Facebook manifest implementation :

        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/facebook_app_id" />

        <activity
            android:name="com.facebook.FacebookActivity"
            android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:label="@string/app_name" />
        <provider
            android:name="com.facebook.FacebookContentProvider"
            android:authorities="com.facebook.app.FacebookContentProvider489732925471830"
            android:exported="true" />

my Facebook share function :

    fun facebookShare() {
        try {
            val content = ShareLinkContent.Builder()
                .setContentUrl(Uri.parse("https://play.google.com/store/apps/details?id=Avedot"))
                .setQuote(getString(R.string.facebookText))
                .build()
            val shareDialog = ShareDialog(this)
            if (shareDialog.canShow(content)) {
                shareDialog.show(content)
            }
        } catch (ex: ActivityNotFoundException) {
            Toast.makeText(this, "Facebook have not been installed.", Toast.LENGTH_SHORT).show()
        }
    }

the result I get is webview based instead of the native Facebook app :

enter image description here

my desired result based on the Facebook native app:

enter image description here



Solution 1:[1]

I face the same issue, and use implementation 'com.facebook.android:facebook-share:latest.release' fixed that.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Robert