Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

New Contributor
Posts: 6
Registered: ‎07-13-2013
My Device: curve 9320
My Carrier: wind mobile

Receiving Sms. [Newbie]

Hey, I was wondering if anyone could make a class which all it does it listens for sms msgs, and then one it finds one it alerts it in a box. Also I would like the varible holding the msg to be public so I can accsess the var from other class's. Anyone up fot the chanllange. I tried my self but failed.

Posts: 354
Registered: ‎06-05-2013
My Device: Blackberry Z10
My Carrier: Vodafone

Re: Receiving Sms. [Newbie]

Try This:

new Thread()
   public void run() 
         _dc = (DatagramConnection)Connector.open(_openString);
             Datagram da = _dc.newDatagram(_dc.getMaximumLength());
             address = new String(da.getAddress());    // mobile number
             msg = new String(da.getData());           // message
      catch ( IOException e) 

 Check whether it works for you or not


Hit Like if you found your solution

Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Receiving Sms. [Newbie]

I recommend the search facility - see the box near the top right.  Type SMS in there and you will find the KB articles which  developer_aman_arora seems to have used.  For example:








In addition, you will find other Threads for people who have asked similar questions.


Good luck in your Blackberry development.