I am just trying to transfer a file through xmpp.I am using asmack lib.I am getting exception below.
E/AndroidRuntime( 332): FATAL EXCEPTION: main
E/AndroidRuntime( 332): java.lang.NullPointerException
E/AndroidRuntime( 332): at org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamManager.enableService(Socks5BytestreamManager.java:704)
E/AndroidRuntime( 332): at org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamManager.activate(Socks5BytestreamManager.java:696)
E/AndroidRuntime( 332): at org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamManager.getBytestreamManager(Socks5BytestreamManager.java:1
80)
E/AndroidRuntime( 332): at org.jivesoftware.smackx.filetransfer.Socks5TransferNegotiator.<init>(Socks5TransferNegotiator.java:50)
E/AndroidRuntime( 332): at org.jivesoftware.smackx.filetransfer.FileTransferNegotiator.<init>(FileTransferNegotiator.java:217)
E/AndroidRuntime( 332): at org.jivesoftware.smackx.filetransfer.FileTransferNegotiator.getInstanceFor(FileTransferNegotiator.java:102)
E/AndroidRuntime( 332): at org.jivesoftware.smackx.filetransfer.FileTransferManager.<init>(FileTransferManager.java:63)
E/AndroidRuntime( 332): at org.apache.android.xmpp.XMPPClient.fileTransfer(XMPPClient.java:143)
E/AndroidRuntime( 332): at org.apache.android.xmpp.XMPPClient.onClick(XMPPClient.java:200)
E/AndroidRuntime( 332): at android.view.View.performClick(View.java:2408)
E/AndroidRuntime( 332): at android.view.View$PerformClick.run(View.java:8816)
E/AndroidRuntime( 332): at android.os.Handler.handleCallback(Handler.java:587)
E/AndroidRuntime( 332): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 332): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 332): at android.app.ActivityThread.main(ActivityThread.java:4627)
E/AndroidRuntime( 332): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 332): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 332): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime( 332): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
can anybody help me how can i do a file transfer in android using asmack?
you have to make a dummy service discovery manager.
now this line does not cause any problems.
First, you have to copy a smack.properties to you android emulator. You can get
smack.properties
at the original SMACK API site.http://www.igniterealtime.org/downloads/source.jsp
push smack.properties into "/data/" folder.
Modify
initialize()
method ofProviderManager.java
(it's inorg/jivesoftware/smack/provider
) as follows.Find the following line.
Replace it with
Hope this help
Please use this one for file transfer in asmack. I have done this and have checked it. Its working perfect.
to receive a file use this method
just ask me if you have any queries regarding file transfer in xmpp using asmack lib.
Thanks