Question

I am retrieving vCard using asmack library. I am able to retrieve the vCard but the response is not exactly what I require, it only gives response

<iq id="3842p-8" to="lalit3686.android@gmail.com" type="get">
                                <vCard xmlns='vcard-temp'><FN>Lalit Poptani</FN>

The expected response is complete detail/information about the user as shown here

I had tried it as 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) {
        e.printStackTrace();
    }

I had also tried using this answer configuring everything thats required. So, is there anything that is required further to retrieve the complete xml of user's vCard?

Était-ce utile?

La solution

Try it using regular Smack in a simple Java app (no android) where you can turn on the debug window (-Dsmack.debugEnabled=true) which will give you the raw stanzas being received from the server. This will at least confirm that the stanza's are correct. If they are not, then you have server problem. I think this is unlikely, since malformed stanzas would typically cause the connection to terminate since the client cannot parse the stream.

If they are correct, then there is probably a problem in the provider itself. According to the documentation, Smacks' VCard class is incomplete, so it is possible that the information being returned is simply not in the list of fields that are parsed.

Knowing the stanza returned would make it easier to verify this.

asmack is derived from Smack so it should behave the exact same way in this particular case (most all cases actually).

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top