I need some example. It’s my first project with XMPP server. I need to create service which sendPresent(get) sendData(or message) and get some data. I need help. Thank!
This is my code :
XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
.setUsernameAndPassword(mSettings.getXmppUserName(), mSettings.getXmppPassword())
.setServiceName(mSettings.getXmmpDomain())
.setHost("host")
.setKeystorePath(mSettings.getXmppPath())
//.setPort(mSettings.getXmppPort())
.setSecurityMode(XMPPTCPConnectionConfiguration.SecurityMode.disabled)
.build(); JID = mSettings.getXmppUserName() + "@" + mSettings.getXmmpDomain(); try {
conn = new XMPPTCPConnection(config);
conn.connect();
logger.error("Connect.......+++++++++++++");
conn.login();
logger.error("Connect.......+++++++++++++");
Presence presence = new Presence(Presence.Type.unavailable);
presence.setStatus("Online " + JID); conn.sendStanza(presence);
logger.error("Online " + JID);
StanzaFilter myFilter = new StanzaFilter() {
public boolean accept(Stanza stanza) {
return true;
}
};