powered by Jive Software

How to send custom XMPP IQ for FCM with ejabbered configuration

I want to send this IQ when connection will authenticated.

Text Message when in push mode

false

applepush

DeviceToken

application1

and i tried this

String childElementNameTicket = “push”;

String childElementNamespaceTicket = “p1:push”;

final String refreshedToken = FirebaseInstanceId.getInstance().getToken();

IQ iq = new IQ(childElementNameTicket, childElementNamespaceTicket) {

@Override

protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) {

//xml.append("<iq type=‘set’ id=" + “’” + refreshedToken + “’” + “>”);

//xml.append("<keepalive max=“30”/>");

xml.append("<keepalive max=“30”/>");

xml.append("<session duration=“60”/>");

xml.append("<body send=“all” groupchat=“true” from=" + “”" + mUsername + “”/>");

xml.append("<status type=“xa”>Text Message when in push mode");

xml.append(“true”);

xml.append(“fcm”+ refreshedToken + “”);

xml.append(“com.azova”);

//xml.append("");

//xml.append("");

return xml;

}

};

iq.setType(IQ.Type.set);

iq.setStanzaId(refreshedToken);

try {

mConnection.sendPacket(iq);

} catch (SmackException.NotConnectedException e) {

e.printStackTrace();

}