java - Send Raw query in IQ XMPP Android -


i trying send raw query in iq in xmpp andriod, not showing me results. unable receive response, infact not know how receive response of query.

here code of connection server

public class networkoperation extends asynctask<string, void, string> {      public static xmppclient xmppclient;     public static xmppconnection connection;     public static connectionconfiguration connconfig;     @override     protected string doinbackground(string... urls) {          xmppclient = settingsdialog.xmppclient;          string host = "web.vlivetech.com"; //gettext(r.id.host);         string port = "5222";  //gettext(r.id.port);         string service = "web.vlivetech.com"; //gettext(r.id.service);         string username = "ssmack@web.vlivetech.com"; //gettext(r.id.userid);         string password = "123456"; //gettext(r.id.password);          // create connection         connconfig = new connectionconfiguration(host, integer.parseint(port),service);         connection = new xmppconnection(connconfig);          try {             connection.connect();             log.i("xmppclient", "[settingsdialog] connected " + connection.gethost());         } catch (xmppexception ex) {             log.e("xmppclient", "[settingsdialog] failed connect " + connection.gethost());             xmppclient.setconnection(null);         }         try {             connection.login(username, password);             log.i("xmppclient", "logged in " + connection.getuser());              // set status available             presence presence = new presence(presence.type.available);             connection.sendpacket(presence);             xmppclient.setconnection(connection);         } catch (xmppexception ex) {             log.e("xmppclient", "[settingsdialog] failed log in " + username);             xmppclient.setconnection(null);         } 

and here code of sending raw query through iq packet right below connection

 packetfilter filter = new iqtypefilter(iq.type.get); // or iq.type.get etc. according filter.           connection.addpacketlistener(new packetlistener() {              public void processpacket(packet packet) {                 // here put code handle iq message                 packet.tostring();             }         }, filter);         // iq query code        final iq iq = new iq() {             public string getchildelementxml() {              return "<query xmlns='http://jabber.org/protocol/disco#info'/>"; // here query             //this returns "<iq type='get' from='user@yourserver/resource' id='info1'> <query xmlns='http://jabber.org/protocol/disco#info'/></iq>";              }};             // set type             iq.settype(iq.type.get);             // send request             connection.sendpacket(iq); 

am missing here?

packetfilter filter = new iqtypefilter(iq.type.get); 

your filter wrong. responses iq of type 'get' either of type 'result' or 'error'.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -