简体   繁体   中英

How to change your own name using Smack?

You can use RosterEntry to get the name of your contacts. But how I change my own name and it appears to my contacts when they do

RosterEntry entry = roster.getEntries("myuser");
entry.getName(); // It needs to show my updated name

Thanks in advance.

As long as the other users haven't set a custom nickname for you, I think Spark will display your first and last name, which you may be able to change with:

VCard me = new VCard();
me.load(conn); // load own VCard
me.setFirstName("John");
me.setLastName("Doe");
me.save(conn);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM