Skip to content
This repository has been archived by the owner on May 17, 2022. It is now read-only.

04. Share Messenger

Hadi Tavakoli edited this page Apr 5, 2018 · 3 revisions

You can also let your users share content privately to their friends using the Messenger application. You can do this using the Facebook.share.shareMessenger method. However, there are two things to notice while using this method.

  1. You must check if user has the Messenger application installed or not.
if(!Facebook.isFacebookMessengerAppInstalled)
{
    trace(You can not share via the Messenger app because it is not installed);
}
else
{
    // now you can use this feature
}
  1. Unlike the dialog sharing which you could see the cancelation or succession of the sharing process, when sharing via the Messenger app, your application cannot know the results.
var content:ShareLinkContent = new ShareLinkContent();
content.contentUrl = "https://myflashlabs.com/";

Facebook.share.shareMessenger(content, function ($error:Error):void
{
    /*
        Content sharing with the messenger app can't be traced! The best you can have is to
        check if an error occurs before ANE tries to open the messenger app.
    */

    if($error)
    {
        trace($error.message);
    }
});