Facebook post message (MessageDialog) not working

I am really taking my time trying to figure out what might be wrong. I have a button (not the fb submit button) and on click I want to open the messenger (or any other way) to send a message to users. This is my code:

MessageDialog messageDialog = new MessageDialog(thisFragment);

    if (MessageDialog.canShow(ShareLinkContent.class)) {

        ShareLinkContent linkContent = new ShareLinkContent.Builder()
                .setContentUrl(Uri.parse("http://developers.facebook.com/android"))
                .build();

        messageDialog.show(linkContent);
    }else{
        Log.e(TAG, "Can't be shown");
    }

      

I tried as many code samples as I could find on the internet. The facebook documentation on sharing is very poor. The code always executes the "else" block in my if statement.

I can show a ShareDialog with the same exact procedure. But the MessageDialog doesn't work and it doesn't even write anything. Is there a way to send a message? Or any source that's tested and working?

Thank you so much

+3


source to share





All Articles