I'm following this guide to create an app which sends an image to Facebook messenger.
String mimeType = "image/png";
Uri contentUri = Uri.parse("android.resource://com.test.test/drawable/foobar");
String metadata = "{ \"name\": \"baz\" }";
ShareToMessengerParams params = ShareToMessengerParams.newBuilder(contentUri, mimeType).setMetaData(metadata).build();
MessengerUtils.shareToMessenger(this, REQUEST_CODE_SHARE_TO_MESSENGER, params);
The code is pretty simple and almost identical to Facebook's own sample code. The image is properly sent to the messenger which recognizes my app to be optimized and supplies the REPLY button. However, I am having trouble getting the metadata sent across. When the REPLY button is pressed, everything that's supposed to be in the extra bundle (EXTRA_IS_REPLY
, EXTRA_THREAD_TOKEN
, EXTRA_PARTICIPANTS
) is sent back to the app but not the metadata. Any help will be greatly appreciated.
Below is a snippet from manifest:
<!-- Activities -->
<activity
android:name=".MainActivity"
android:windowSoftInputMode="stateHidden"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<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>
<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_20150314"/>
</intent-filter>
</activity>