Add the following dependency to your build.gradle
:
dependencies {
... other dependencies ...
compile "com.mobidevelop.robovm:robopods-facebook-ios-messenger:$robopodsVersion"
}
Add the following dependency to your pom.xml
:
<dependency>
<groupId>com.mobidevelop.robovm</groupId>
<artifactId>robopods-facebook-ios-messenger</artifactId>
<version>${robopods.version}</version>
</dependency>
Use the FBSDKMessengerSharer
to send images, animated gifs, videos and audio clips to Messenger.
UIImage image = UIImage.getImage("selfie_pic");
FBSDKMessengerSharer.shareImage(image, null);
String filepath = NSBundle.getMainBundle().findResourcePath("corgi", "webp");
NSData webpData = NSData.read(new File(filepath));
FBSDKMessengerSharer.shareAnimatedWebP(webpData, null);
String filepath = NSBundle.getMainBundle().findResourcePath("selfie_gif", "gif");
NSData gifData = NSData.read(new File(filepath));
FBSDKMessengerSharer.shareAnimatedGIF(gifData, null);
String filepath = NSBundle.getMainBundle().findResourcePath("selfie_vid", "mp4");
NSData videoData = NSData.read(new File(filepath));
FBSDKMessengerSharer.shareVideo(videoData, null);
String filepath = NSBundle.getMainBundle().findResourcePath("selfie", "mp3");
NSData mp3Data = NSData.read(new File(filepath));
FBSDKMessengerSharer.shareAudio(mp3Data, null);
Add a resource to your app and share it with one of the above code snippets. If you have setup a test account on Facebook you should be able to see the shared resources in the Messenger app.