Utilities for Messenger Content Platform.
Applications should specify the app id in their manifest or call MessengerUtils.setAppId(String) 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 MessengerUtils.shareToMessenger method. For example,
ShareToMessengerParams 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 MessengerUtils.getMessengerThreadParamsForIntent to receive the parameters for messenger. When the user has clicked the Sened button to send the content to Messenger, ten call MessengerUtils.finishShareToMessenger to return the data back to Messenger.
الإضافات: | Object |
الحزمة: | messenger |
MessengerUtils()
public MessengerUtils()
getMessengerThreadParamsForIntent(Intent)
When handling an Intent from Messenger, call this to parse the parameters of the intent.
public static MessengerThreadParams getMessengerThreadParamsForIntent(Intent intent)
المعلمة | الوصف |
---|---|
intent | The intent of the activity |
hasMessengerInstalled(Context)
Checks whether any version of messenger is installed.
public static boolean hasMessengerInstalled(Context context)
المعلمة | الوصف |
---|---|
context | An android context |
openMessengerInPlayStore(Context)
Opens the play store to install Messenger.
public static void openMessengerInPlayStore(Context context)
المعلمة | الوصف |
---|---|
context | An android context. |
PACKAGE_NAME
public static final String PACKAGE_NAME
APPLICATION_ID_PROPERTY
public static final String APPLICATION_ID_PROPERTY
EXTRA_PROTOCOL_VERSION
public static final String EXTRA_PROTOCOL_VERSION
EXTRA_APP_ID
public static final String EXTRA_APP_ID
EXTRA_REPLY_TOKEN_KEY
public static final String EXTRA_REPLY_TOKEN_KEY
EXTRA_THREAD_TOKEN_KEY
public static final String EXTRA_THREAD_TOKEN_KEY
EXTRA_METADATA
public static final String EXTRA_METADATA
EXTRA_EXTERNAL_URI
public static final String EXTRA_EXTERNAL_URI
EXTRA_PARTICIPANTS
public static final String EXTRA_PARTICIPANTS
EXTRA_IS_REPLY
public static final String EXTRA_IS_REPLY
EXTRA_IS_COMPOSE
public static final String EXTRA_IS_COMPOSE
PROTOCOL_VERSION_20150314
public static final int PROTOCOL_VERSION_20150314
ORCA_THREAD_CATEGORY_20150314
public static final String ORCA_THREAD_CATEGORY_20150314