Search code examples
androidxmppasmack

How to pass custom resource in asmack


I am sure this is possible using ConnectionConfiguration, but I am not able to find a documentation for the same. I need a different resource than Smack. My current code looks like this -

ConnectionConfiguration connectionConfig = new ConnectionConfiguration(HOST,PORT, SERVICE);
XMPPConnection connection = new XMPPTCPConnection(connectionConfig);
connection.connect();

How can I pass a custom JID resource in it?


Solution

  • You should be able to pass the resource in the login method:

    conn.login(username, password, resource);
    

    Reference: https://www.igniterealtime.org/builds/smack/docs/latest/javadoc/org/jivesoftware/smack/XMPPConnection.html#login(java.lang.String,%20java.lang.String,%20java.lang.String)