Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to put Custom fields to XMPP vCard Android/SMACK

I am currently developing a chat application and I am using the following Vcard to store User information.

public void run() {
VCard vcard = new VCard();
vcard.setJabberId(xmppConnection.getUser());
vcard.setNickName(user.getChatId());
vcard.setFirstName(user.getUsername());
vcard.setPhoneHome("CELL", user.getMobileNo()); }

In addition to the above values I want to add new fields to the Vcard like

vcard.setNotificationType(user.getNotType())
vcard.setAlerts(user.getAlerts())

Is this possible? If so please help me on how to do it. Thanks.

like image 403
Kishath Avatar asked Sep 19 '14 10:09

Kishath


1 Answers

I know it's an old question but maybe someone would need the answer..

You can use vCard.setField(String field, String value)

For Example :

vcard.setField("NotificationType", user.getNotType());

And to get it back :

vcard.getField("NotificationType");
like image 150
Muhammad Ashraf Avatar answered Sep 28 '22 10:09

Muhammad Ashraf