Package 

Object MessengerUtils


  • 
    public class MessengerUtils
    
                        

    Utilities for Messenger Content Platform.

    Applications should specify the app id in their manifest or call com.facebook.FacebookSdk.setApplicationId in their application startup path. For specifying in the manifest, add a meta tag in your <application> tag.

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

    When sharing to Messenger, apps should call the shareToMessenger method. For example,

    val params = ShareToMessengerParams.newBuilder(uri, "image/ *")
      .setMetaData(metaData)
      .build();
    MessengerUtils.shareToMessenger(this, REQUEST_CODE_SHARE_TO_MESSENGER, params);

    To handle receiving a composer shortcut or reply intent from Messenger, apps should put the following intent filter in their manifest for the activity that receives the intent:

    <intent-filter>
      <action android:name="android.intent.action.PICK" />
      <category android:name="android.intent.category.DEFAULT"/>
      <category android:name="com.facebook.orca.category.PLATFORM_THREAD_20150311"/>
    </intent-filter>

    When handling the intent, then call getMessengerThreadParamsForIntent to receive the parameters for messenger. When the user has clicked the Send button to send the content to Messenger, then call finishShareToMessenger to return the data back to Messenger.