Please note that this used to work on the same server in Smack 4.1.0-alpha6. This stopped working when I upgraded from alpha6 to 4.1.0-beta2 and still doesn’t work in 4.1.0-rc1. Minor changes in the code have been made to match the library differences over these versions:
Connection code:
if (connection != null && connection.isConnected()) {
connection.disconnect();
}
XMPPTCPConnectionConfiguration.Builder builder =
XMPPTCPConnectionConfiguration.builder();
builder.setSecurityMode(SecurityMode.ifpossible);
SmackConfiguration.DEBUG = isDebugMode;
builder.setDebuggerEnabled(isDebugMode);
builder.setHost(uri);
builder.setPort(port);
builder.setServiceName(serviceName);
builder.setConnectTimeout(timeout);
builder.setCompressionEnabled(true);
builder.setUsernameAndPassword(userName, password);
XMPPTCPConnectionConfiguration config = builder.build();
connection = new XMPPTCPConnection(config);
listenerMonitor.assignListenersToConnection(connection);
connection.connect();
connection.login();
Save vCard Code:
VCardManager vCardManager = VCardManager.getInstanceFor(connection);
boolean isSupported = vCardManager.isSupported(user.userName());
if (BuildConfig.DEBUG) {
Log.d(MyApp.APPLICATION_NAME, "isSupported:" + isSupported);
}
vCard = vCardManager.loadVCard();
vCard.setNickName(user.displayName());
vCard.setEmailHome(profile.getEmailAddress());
vCard.setPhoneHome(VCARD_PHONE_TYPE, profile.getPhoneNumber());
vCardManager.saveVCard(vCard);
Error Logs:
02-23 10:28:36.148 17187-17187/com.myDomain.myChatApp E/Trace﹕ error opening trace file: No such file or directory (2)
02-23 10:28:36.218 17187-17187/com.myDomain.myChatApp I/System.out﹕ Sending WAIT chunk
02-23 10:28:36.218 17187-17187/com.myDomain.myChatApp W/ActivityThread﹕ Application com.myDomain.myChatApp is waiting for the debugger on port 8100...
02-23 10:28:36.586 17187-17193/com.myDomain.myChatApp I/dalvikvm﹕ Debugger is active
02-23 10:28:36.617 17187-17187/com.myDomain.myChatApp I/System.out﹕ Debugger has connected
02-23 10:28:36.617 17187-17187/com.myDomain.myChatApp I/System.out﹕ waiting for debugger to settle...
02-23 10:28:36.820 17187-17187/com.myDomain.myChatApp I/System.out﹕ waiting for debugger to settle...
02-23 10:28:37.023 17187-17187/com.myDomain.myChatApp I/System.out﹕ waiting for debugger to settle...
02-23 10:28:37.218 17187-17187/com.myDomain.myChatApp I/System.out﹕ waiting for debugger to settle...
02-23 10:28:37.422 17187-17187/com.myDomain.myChatApp I/System.out﹕ waiting for debugger to settle...
02-23 10:28:37.625 17187-17187/com.myDomain.myChatApp I/System.out﹕ waiting for debugger to settle...
02-23 10:28:37.828 17187-17187/com.myDomain.myChatApp I/System.out﹕ waiting for debugger to settle...
02-23 10:28:38.023 17187-17187/com.myDomain.myChatApp I/System.out﹕ waiting for debugger to settle...
02-23 10:28:38.234 17187-17187/com.myDomain.myChatApp I/System.out﹕ waiting for debugger to settle...
02-23 10:28:38.429 17187-17187/com.myDomain.myChatApp I/System.out﹕ debugger has settled (1436)
02-23 10:28:39.758 17187-17187/com.myDomain.myChatApp D/libEGL﹕ loaded /vendor/lib/egl/libEGL_POWERVR_SGX540_120.so
02-23 10:28:39.828 17187-17187/com.myDomain.myChatApp D/libEGL﹕ loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so
02-23 10:28:39.836 17187-17187/com.myDomain.myChatApp D/libEGL﹕ loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so
02-23 10:28:40.031 17187-17187/com.myDomain.myChatApp D/OpenGLRenderer﹕ Enabling debug mode 0
02-23 10:28:40.258 17187-17239/com.myDomain.myChatApp D/libc﹕ Forward DNS query to netd(h=chat.myDomain.com s=^)
02-23 10:28:40.336 17187-17191/com.myDomain.myChatApp D/dalvikvm﹕ GC_CONCURRENT freed 1169K, 13% free 8710K/9955K, paused 13ms+3ms, total 40ms
02-23 10:28:40.398 17187-17244/com.myDomain.myChatApp D/SMACK﹕ SENT (0): <stream:stream xmlns='jabber:client' to='chat.myDomain.com' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' from='exampleUser@chat.myDomain.com@chat.myDomain.com' xml:lang='en'>
02-23 10:28:40.429 17187-17245/com.myDomain.myChatApp D/SMACK﹕ RECV (0): <?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="chat.myDomain.com" id="28ff497e" xml:lang="en" version="1.0">
02-23 10:28:40.445 17187-17245/com.myDomain.myChatApp D/SMACK﹕ RECV (0): <stream:features><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"><required/></starttls><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>CRAM-MD5</mechanism><mechanism>DIGEST-MD5</mechanism></mechanisms></stream:features>
02-23 10:28:40.461 17187-17244/com.myDomain.myChatApp D/SMACK﹕ SENT (0): <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'></starttls>
02-23 10:28:40.515 17187-17245/com.myDomain.myChatApp D/SMACK﹕ RECV (0): <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>
02-23 10:28:41.476 17187-17244/com.myDomain.myChatApp D/SMACK﹕ SENT (0): <stream:stream xmlns='jabber:client' to='chat.myDomain.com' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' from='exampleUser@chat.myDomain.com@chat.myDomain.com' xml:lang='en'>
02-23 10:28:41.492 17187-17245/com.myDomain.myChatApp D/SMACK﹕ RECV (0): <?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="chat.myDomain.com" id="28ff497e" xml:lang="en" version="1.0"><stream:features><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>CRAM-MD5</mechanism><mechanism>DIGEST-MD5</mechanism></mechanisms><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><auth xmlns="http://jabber.org/features/iq-auth"/><register xmlns="http://jabber.org/features/iq-register"/></stream:features>
02-23 10:28:41.515 17187-17244/com.myDomain.myChatApp D/SMACK﹕ SENT (0): <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='DIGEST-MD5'>=</auth>
02-23 10:28:41.601 17187-17245/com.myDomain.myChatApp D/SMACK﹕ RECV (0): <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cmVhbG09ImNoYXQuaHVzaGVkYnl0ZS5jb20iLG5vbmNlPSJaYmJKZlBPTGUxUlptWTMzYkorMzliTzU0VGVyWlJRaUxaVVJJTDhVIixxb3A9ImF1dGgiLGNoYXJzZXQ9dXRmLTgsYWxnb3JpdGhtPW1kNS1zZXNz</challenge>
02-23 10:28:41.640 17187-17244/com.myDomain.myChatApp D/SMACK﹕ SENT (0): <response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>dXNlcm5hbWU9InQxb3JhY2xlQGNoYXQuaHVzaGVkYnl0ZS5jb20iLHJlYWxtPSJjaGF0Lmh1c2hlZGJ5dGUuY29tIixub25jZT0iWmJiSmZQT0xlMVJabVkzM2JKKzM5Yk81NFRlclpSUWlMWlVSSUw4VSIsY25vbmNlPSJYRldDTU5SbHNPN1N2eE11RFAwMXY3Q2FlbTVJWFlKMSIsbmM9MDAwMDAwMDEscW9wPWF1dGgsZGlnZXN0LXVyaT0ieG1wcC9jaGF0Lmh1c2hlZGJ5dGUuY29tIixyZXNwb25zZT1kMzM2NmNiN2NhMTQwZDI4NTE3OTVmNDVjOGY4ODk0MSxjaGFyc2V0PXV0Zi04</response>
02-23 10:28:41.703 17187-17245/com.myDomain.myChatApp D/SMACK﹕ RECV (0): <success xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cnNwYXV0aD1mNzhlYmFiMzQzNzRlNjRlYTc1OTlkOGE0MDg5ZTRhMQ==</success>
02-23 10:28:41.726 17187-17244/com.myDomain.myChatApp D/SMACK﹕ SENT (0): <stream:stream xmlns='jabber:client' to='chat.myDomain.com' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' from='exampleUser@chat.myDomain.com@chat.myDomain.com' id='28ff497e' xml:lang='en'>
02-23 10:28:41.742 17187-17245/com.myDomain.myChatApp D/SMACK﹕ RECV (0): <?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="chat.myDomain.com" id="28ff497e" xml:lang="en" version="1.0"><stream:features><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"/><session xmlns="urn:ietf:params:xml:ns:xmpp-session"/></stream:features>
02-23 10:28:41.765 17187-17244/com.myDomain.myChatApp D/SMACK﹕ SENT (0): <compress xmlns='http://jabber.org/protocol/compress'><method>zlib</method></compress>
02-23 10:28:41.836 17187-17245/com.myDomain.myChatApp D/SMACK﹕ RECV (0): <compressed xmlns='http://jabber.org/protocol/compress'/>
02-23 10:28:41.859 17187-17244/com.myDomain.myChatApp D/SMACK﹕ SENT (0): <stream:stream xmlns='jabber:client' to='chat.myDomain.com' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' from='exampleUser@chat.myDomain.com@chat.myDomain.com' id='28ff497e' xml:lang='en'>
02-23 10:28:41.883 17187-17245/com.myDomain.myChatApp D/SMACK﹕ RECV (0): <?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="chat.myDomain.com" id="28ff497e" xml:lang="en" version="1.0"><stream:features><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>CRAM-MD5</mechanism><mechanism>DIGEST-MD5</mechanism></mechanisms><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"/><session xmlns="urn:ietf:params:xml:ns:xmpp-session"/></stream:features>
02-23 10:28:41.914 17187-17244/com.myDomain.myChatApp D/SMACK﹕ SENT (0): <iq id='RKXGv-1' type='set'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><resource>Smack</resource></bind></iq>
02-23 10:28:41.945 17187-17245/com.myDomain.myChatApp D/SMACK﹕ RECV (0): <iq type="result" id="RKXGv-1" to="chat.myDomain.com/28ff497e"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><jid>exampleUser@chat.myDomain.com/Smack</jid></bind></iq>
02-23 10:28:41.976 17187-17244/com.myDomain.myChatApp D/SMACK﹕ SENT (0): <iq id='RKXGv-3' type='set'><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></iq>
02-23 10:28:42.000 17187-17245/com.myDomain.myChatApp D/SMACK﹕ RECV (0): <iq type="result" id="RKXGv-3" to="exampleUser@chat.myDomain.com/Smack"/>
02-23 10:28:42.031 17187-17239/com.myDomain.myChatApp D/SMACK﹕ User logged (0): exampleUser@chat.myDomain.com:5222/Smack
02-23 10:28:42.070 17187-17244/com.myDomain.myChatApp D/SMACK﹕ SENT (0): <iq id='RKXGv-5' type='get'><query xmlns='jabber:iq:roster'></query></iq>
02-23 10:28:42.070 17187-17239/com.myDomain.myChatApp D/SMACK﹕ XMPPConnection authenticated (0)
02-23 10:28:42.078 17187-17244/com.myDomain.myChatApp D/SMACK﹕ SENT (0): <presence id='RKXGv-6'></presence>
02-23 10:28:42.093 17187-17244/com.myDomain.myChatApp D/SMACK﹕ SENT (0): <iq id='RKXGv-7' type='get'><query xmlns='jabber:iq:roster'></query></iq>
02-23 10:28:42.187 17187-17245/com.myDomain.myChatApp D/SMACK﹕ RECV (0): <iq type="result" id="RKXGv-5" to="exampleUser@chat.myDomain.com/Smack"><query xmlns="jabber:iq:roster"/></iq>
02-23 10:28:42.195 17187-17245/com.myDomain.myChatApp D/SMACK﹕ RECV (0): <presence id="RKXGv-6" from="exampleUser@chat.myDomain.com/Smack" to="exampleUser@chat.myDomain.com/Smack"/>
02-23 10:28:42.211 17187-17245/com.myDomain.myChatApp D/SMACK﹕ RECV (0): <iq type="result" id="RKXGv-7" to="exampleUser@chat.myDomain.com/Smack"><query xmlns="jabber:iq:roster"/></iq>
02-23 10:28:42.273 17187-17244/com.myDomain.myChatApp D/SMACK﹕ SENT (0): <iq id='RKXGv-11' type='get'><vCard xmlns='vcard-temp'/></iq>
02-23 10:28:42.289 17187-17245/com.myDomain.myChatApp D/SMACK﹕ RECV (0): <iq type="result" id="RKXGv-11" to="exampleUser@chat.myDomain.com/Smack"><vCard xmlns="vcard-temp"/></iq>
02-23 10:28:42.297 17187-17244/com.myDomain.myChatApp D/SMACK﹕ SENT (0): <presence id='RKXGv-13'><status></status><priority>0</priority></presence>
02-23 10:28:42.320 17187-17245/com.myDomain.myChatApp D/SMACK﹕ RECV (0): <presence id="RKXGv-13" from="exampleUser@chat.myDomain.com/Smack" to="exampleUser@chat.myDomain.com/Smack"><status/><priority>0</priority></presence>
02-23 10:30:35.711 17187-17187/com.myDomain.myChatApp W/IInputConnectionWrapper﹕ clearMetaKeyStates on inactive InputConnection
02-23 10:31:42.578 17187-17245/com.myDomain.myChatApp D/SMACK﹕ RECV (0): <iq type="get" id="756-3" from="chat.myDomain.com" to="exampleUser@chat.myDomain.com/Smack"><ping xmlns="urn:xmpp:ping"/></iq>
02-23 10:31:42.609 17187-17244/com.myDomain.myChatApp D/SMACK﹕ SENT (0): <iq to='chat.myDomain.com' id='756-3' type='result'></iq>
02-23 10:33:01.003 17187-17187/com.myDomain.myChatApp D/android.widget.GridLayout﹕ vertical constraints: y2-y1>=71, y3-y2>=71, y4-y3>=71, y5-y4>=0, y6-y5>=70, y7-y6>=84, y8-y7>=84, y9-y8>=78, y9-y0<=850, y4-y3<=41, y3-y2<=41, y2-y1<=41 are inconsistent; permanently removing: y9-y0<=850, y4-y3<=41, y3-y2<=41, y2-y1<=41.
02-23 10:33:20.651 17187-17244/com.myDomain.myChatApp D/SMACK﹕ SENT (0): <iq to='exampleUser@chat.myDomain.com' id='RKXGv-17' type='get'><query xmlns='http://jabber.org/protocol/disco#info'></query></iq>
02-23 10:33:20.675 17187-17245/com.myDomain.myChatApp D/SMACK﹕ RECV (0): <iq type="result" id="RKXGv-17" from="exampleUser@chat.myDomain.com" to="exampleUser@chat.myDomain.com/Smack"><query xmlns="http://jabber.org/protocol/disco#info"><identity category="account" type="registered"/><identity category="pubsub" type="pep"/><feature var="http://jabber.org/protocol/disco#info"/></query></iq>
02-23 10:33:20.698 17187-17573/com.myDomain.myChatApp D/MyChatApp﹕ isSupported:false
02-23 10:33:20.729 17187-17244/com.myDomain.myChatApp D/SMACK﹕ SENT (0): <iq id='RKXGv-19' type='get'><vCard xmlns='vcard-temp'/></iq>
02-23 10:33:20.745 17187-17245/com.myDomain.myChatApp D/SMACK﹕ RECV (0): <iq type="result" id="RKXGv-19" to="exampleUser@chat.myDomain.com/Smack"><vCard xmlns="vcard-temp"/></iq>
02-23 10:33:20.792 17187-17244/com.myDomain.myChatApp D/SMACK﹕ SENT (0): <iq to='exampleUser@chat.myDomain.com/Smack' id='RKXGv-19' type='set'><vCard xmlns='vcard-temp'><NICKNAME>exampleUser@chat.myDomain.com</NICKNAME><EMAIL><HOME/><INTERNET/><PREF/><USERID>exampleUser@gmail.com</USERID></EMAIL><TEL><HOME/><CELL/><NUMBER>1234567890</NUMBER></TEL></vCard></iq>
02-23 10:33:20.823 17187-17245/com.myDomain.myChatApp D/SMACK﹕ RECV (0): <iq to="exampleUser@chat.myDomain.com/Smack" id="RKXGv-19" type="set" from="exampleUser@chat.myDomain.com/Smack"><vCard xmlns="vcard-temp"><NICKNAME>exampleUser@chat.myDomain.com</NICKNAME><EMAIL><HOME/><INTERNET/><PREF/><USERID>exampleUser@gmail.com</USERID></EMAIL><TEL><HOME/><CELL/><NUMBER>1234567890</NUMBER></TEL></vCard></iq>
02-23 10:33:20.846 17187-17244/com.myDomain.myChatApp D/SMACK﹕ SENT (0): <iq to='exampleUser@chat.myDomain.com/Smack' id='RKXGv-19' type='error'><error type='cancel'><feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq>
02-23 10:33:20.862 17187-17245/com.myDomain.myChatApp D/SMACK﹕ RECV (0): <iq to="exampleUser@chat.myDomain.com/Smack" id="RKXGv-19" type="error" from="exampleUser@chat.myDomain.com/Smack"><error type="cancel"><feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></iq>
02-23 10:33:20.932 17187-17573/com.myDomain.myChatApp E/MyChatApp﹕ NetworkFault
com.myDomain.myChatApp.exceptions.NetworkFault: XMPPError: feature-not-implemented - cancel
at com.myDomain.myChatApp.xmpp.XMPPChatService.setProfile(XMPPChatService.java:242)
at com.myDomain.myChatApp.android.base.chatService.AndroidAsyncChatService$4.doInBackground(AndroidAsyncChatService.java:173)
at com.myDomain.myChatApp.android.base.chatService.AndroidAsyncChatService$4.doInBackground(AndroidAsyncChatService.java:169)
at android.os.AsyncTask$2.call(AsyncTask.java:287)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
Caused by: XMPPError: feature-not-implemented - cancel
at org.jivesoftware.smack.PacketCollector.nextResultOrThrow(PacketCollector.java:220)
at org.jivesoftware.smack.PacketCollector.nextResultOrThrow(PacketCollector.java:201)
at org.jivesoftware.smackx.vcardtemp.VCardManager.saveVCard(VCardManager.java:95)
at com.myDomain.myChatApp.xmpp.XMPPChatService.setProfile(XMPPChatService.java:240)
at com.myDomain.myChatApp.android.base.chatService.AndroidAsyncChatService$4.doInBackground(AndroidAsyncChatService.java:173)
at com.myDomain.myChatApp.android.base.chatService.AndroidAsyncChatService$4.doInBackground(AndroidAsyncChatService.java:169)
at android.os.AsyncTask$2.call(AsyncTask.java:287)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
Please fix this. Thank you.