Read multiple incoming sms's in blackberry -


i have code

            datagramconnection _dc =(datagramconnection)connector.open("sms://");                      datagram d = _dc.newdatagram(_dc.getmaximumlength());                            _dc.receive(d); //receive sms             byte[] bytes = d.getdata();             string address = d.getaddress(); //the address of sms put on string.             string msg = new string(bytes); 

does above code listen incoming sms's on continuous basis, or listen 1 sms? if listens 1 sms can please provide me code listen sms's on continuous basis.

your code reads single sms. if need read every sms delivered, need loop 1 posted in the official knowledge base article:

        datagramconnection _dc = (datagramconnection)connector.open("sms://");         for(;;) {                datagram d = _dc.newdatagram(_dc.getmaximumlength());                _dc.receive(d);                byte[] bytes = d.getdata();                string address = d.getaddress();                string msg = new string(bytes);                system.out.println( "received sms text " + address + " : " + msg);          } 

now question arises: bb os delivering smss listening apps in serial way? if (i think never tested extent), need forward message possible consumer (otherwise hogging connection listener thread during sms processing).


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -