how to use smack 4.1 for how to send info query packet to xmpp server?
Asked Answered
P

1

3

how to send info query packet to xmpp server, in other words how to send "..." to server to query some information?

<iq type='set' id='123'>
 <push xmlns='p1:push'>
   <keepalive max="30"/>
   <session duration="60"/>
   <body send="all" groupchat="true" from="jid"/>
   <status type="xa">Text Message when in push mode</status>
   <offline>false</offline>
   <notification>
       <type>applepush</type>
       <id>DeviceToken</id>
   </notification>
   <appid>application1</appid>
 </push>
</iq>
Prickett answered 13/1, 2017 at 9:12 Comment(5)
Do you want custom IQ or this represent any basic XEP?Aconcagua
i want to convert above into IQProvider for configuration @AconcaguaBhagavadgita
Jump to step 3: #37965856Aconcagua
i want to sent push config to XMPP for firebase can it possible using this @AconcaguaBhagavadgita
Let us continue this discussion in chat.Bhagavadgita
P
3

The iq headers and the namespace,element are handled or filled in the xml by smack itself. A sample IQ packet in xml and its implementation by extending IQ packet are given below.

<iq to='[email protected]' id='khz0k-13678' type='get'><elementName xmlns='http://jabber.org/protocol/muc#something'><item affiliation="member"/></elementName></iq>

public class IQGetSomething extends IQ {
public static final String ELEMENT = "elementName";
public static final String NAMESPACE = "http://jabber.org/protocol/muc#something";
String memberType;

public IQGetSomething() {
    super(ELEMENT, NAMESPACE);
    setType(Type.get);
}

public String getMemberType() {
    return memberType;
}

public void setMemberType(String memberType) {
    this.memberType = memberType;
}


@Override
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) {
    xml.rightAngleBracket();
    xml.append("<item affiliation=\"").escape(memberType).append("\"/>");
    return xml;
}
}
Phytogenesis answered 13/1, 2017 at 19:15 Comment(4)
how can we use Firebase with XMPP by sending refresh Token when XMPP connection is initialize ?@FlowBhagavadgita
how can i send above param by xml in XMPP for push configuration ?? @PhytogenesisBhagavadgita
how to send IQGetSomething to connection object in android ??Bhagavadgita
W/AbstractXMPPConnection: Connection closed with error when i tried to declare this class object in smack connectionBhagavadgita

© 2022 - 2024 — McMap. All rights reserved.