Bhaskar
Bhaskar

Reputation: 23

How can i transfer an image through facebook chat application in android?

I am new to android. I am developing facebook chat application which has the feature of sending images to friend who is in chat list. I tried to do by using asmack api FileTranfer classes to send image. But, there was a problem in sending. Here is the code to transfer a file using asmack api.

// Create the file transfer manager
        ConnectionConfiguration config =    new ConnectionConfiguration("chat.facebook.com", 5222, "chat.facebook.com");
           config.setDebuggerEnabled(true);
          config.setSASLAuthenticationEnabled(true);

      FileTransferManager manager = new FileTransferManager(new XMPPConnection(config));

      // Create the outgoing file transfer
      OutgoingFileTransfer transfer = manager.createOutgoingFileTransfer(friend_id);

      // Send the file
      transfer.sendFile(new File("path of image from sd card"), "You won't believe this!");

Here, throwing a NullPointerException at the FileTransferManager statement

Is there any method to send image,audio,video in facebook official api for android. Please advice me. Thanks in advance.

Upvotes: 0

Views: 4005

Answers (1)

Nitzan Tomer
Nitzan Tomer

Reputation: 164147

Have you read the documentation for the Facebook Chat API? It clearly states in the Features and Limitations that:

Sending and receiving plain-text messages (not HTML messages)

It says nothing about images. Also:

Facebook Chat should be compatible with every XMPP client, but is not a full XMPP server. It should be thought of as a proxy into the world of Facebook Chat on www.facebook.com. As a result, it has several behaviors that differ slightly from what you would expect from a traditional XMPP service

As far as I'm aware, you can not send images using the chat API, and the docs pretty much back this up.

Upvotes: 3

Related Questions