How can I know the exist of JID(String) when using Smack?
Would you please give me a example Code?
Many thanks!
How can I know the exist of JID(String) when using Smack?
Would you please give me a example Code?
Many thanks!
Could you rephrase your question?
In Smack, when using existing methode and Class, can I know is there any created account(JID,a String) on some server(Jabberd2, eg. jabber.org)?
Could you please give me a specific example code?
Many thanks!
This should do it:
AccountManager manager = conn.getAccountManager();
if (manager.supportsAccountCreation())
{
try
{
manager.createAccount(userName, password, attributes);
// if you carry on here the jid doesn’'t exist
}
catch (XMPPException e)
{
// if you fall in here the jid exists
}
}
/code
If there is a better way - let me know!
Alex
Thank you!
That’‘s right, I think we can’‘t did it in directly ways use smack. But it will create many invalid accounts in server, that’'s too bad.
He He, it’'s just so!
Thank you!