Not getting an exact response from vCard using asmack

I am extracting a vCard using the asmack library. I can get vCard but the answer is not exactly what I need, it only gives the answer

<iq id="3842p-8" to="" type="get">
                                <vCard xmlns='vcard-temp'><FN>Lalit Poptani</FN>


The expected answer is complete user info / info as shown here

I tried it like below,

VCard vCard = new VCard();
try {
        ProviderManager.getInstance().addIQProvider("vCard", "vcard-temp",
                                                            new VCardProvider());
        vCard.load(conn, user);
        Log.d("Vcard XML", vCard.toXML());
    } catch (XMPPException e) {


I also tried using this answer , setting up whatever is required. So, is there anything further required to get the full xml of a custom vCard?


source to share

1 answer

Try using regular Smack in a simple Java application (no android) where you can enable a debug window (-Dsmack.debugEnabled = true) which will give you raw stanzas fetched from the server. This at least confirms the correctness of the stanza. If not, then you have a server problem. I think this is unlikely, as incorrect stanzas usually lead to the connection being terminated as the client cannot parse the stream.

If they are correct, the problem may be with the provider itself. According to the documentation, the Smacks VCard class is incomplete , so it is possible that the information returned is simply not in the list of fields that are parsed.

Knowing that the returned stanza will simplify this.

asmack is derived from Smack, so it should behave exactly the same in this particular case (most cases in fact).



All Articles