XMPP Response IQ doesn't show or bring back the IQ response

Running following code with ejabberd server at back and it performs its tasks. However, this doesn’t show up in ejabberd log/debug file and/or IQ response isn’t getting back to client device (smack 4.4.2). How can I get the IQ response back, do we need to add code in this code for returning the IQ result/response? or I am missing something?

            DataForm.Builder xep0004 = DataForm.builder(DataForm.Type.submit);  //new DataForm(DataForm.Type.submit);
            TextSingleFormField.Builder token = FormField.builder("token");
            token.setValue(App.user_settings.getFirebaseToken(App.mContext));
            TextSingleFormField.Builder device_id = FormField.builder("android-id"); //new FormField("device-id");
            device_id.setValue(App.user_settings.getECCID(App.mContext));

            xep0004.addField(token.build());
            xep0004.addField(device_id.build());
  
            IQ pushStanza = new IQ("command", "http://jabber.org/protocol/commands") {
                @Override
                protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) {
                    xml.attribute("action", "execute");
                    xml.attribute("node", "register-push-fcm");
                    xml.setEmptyElement();
                    return xml;
                }
            };
            pushStanza.setType(IQ.Type.set);
            pushStanza.setTo(JidCreate.from("p2.pgpnet.fi"));
            pushStanza.setFrom(connection.getUser());
            pushStanza.addExtension(xep0004.build());
            
            if (connection.isSmEnabled()) {
                try {
                    connection.addStanzaIdAcknowledgedListener(pushStanza.getStanzaId(), new StanzaListener() {
                        @Override
                        public void processStanza(Stanza stanza) throws NotConnectedException, InterruptedException, SmackException.NotLoggedInException {
                            Log.e("stanza result", stanza.toXML().toString());
                           // registerTokenToXmpp1();
                        }
                    });
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            connection.sendStanza(pushStanza);

Openfire does not have support for this particular ad-hoc command, which is why you do not get a result (you should get an error response back though).

This seems to relate to push notifications (XEP-0357). This particular ad-hoc command is used by the client to invoke an action on the app-server. Openfire rarely acts as an app server, but, through the Push Notifications plugin does support push notifications. Is that perhaps what you need (in combination with a third-party app-server)?

This topic was automatically closed 62 days after the last reply. New replies are no longer allowed.