By getting only a SMS message

Hello, I'm listening for SMS sending using datagram and I get successfully the FIRST sms when the program starts, after any chance...

 private static class ListeningThread extends Thread
    {
        private boolean _stop = false;
        private DatagramConnection _dc;

        public synchronized void stop()
        {
            _stop = true; 

            try
            {
                if( _dc != null)
                {
                    _dc.close();
                }
            }
            catch(Exception e){System.out.println("error closing");}
        }
        public void run()
        { 

            try
            {
                //listening on port 0 I was able to receieve text messages...
                //however I will test without it and maybe that would also work..
                DatagramConnection _dc = (DatagramConnection)Connector.open("sms://");
                for(;;)
                {
                    //probably add in this stop code... taken from smsdemo
                    //but I didn't use it when it worked so *shrugs*
                    if (_stop)
                    {
                        return;
                    }
                    Datagram d = _dc.newDatagram(_dc.getMaximumLength());
                    _dc.receive(d);

                }
            }
            catch(Exception e){}
        }
    }

I have a debug message just after _dc.recieve (d); that I removed. But I only get the first message. How avoid that receive messages after the first?

Thank you

My guess is that you throw an exception that takes you out of the loop for ().

Try a while(!_stop) loop and placing you try/catch inside the loop block.

Tags: BlackBerry Developers

Similar Questions

  • How to get all the SMS messages?

    Hi all

    I want to get all the SMS messages in my application, but I can only find the API to get the mails.

    I have search the Forum and know the method of listening to SMS messages, but not to get all SMS messages in the Inbox.

    Can someone help me? Thank you.

    I'm afraid you cannot access the SMS Inbox and not either, you can manipulate the messages as soon as they reach the Inbox.
    However, as you already mentioned, you can listen to them on their way to the Inbox.

  • Card SIM full blackBerry Smartphones after only 10 SMS messages

    I just got my BB 9000 and took my old SIM card and placed in the BB.

    On the card SIM was a few SMS messages (the SIM card is only 5 days old) and initially the BB seems to work very well. After receiving very little SMS' are I was presented with an error message saying that the SIM card is full and that I should delete the SMS messages to make room for the new.

    .. After only 10 SMS' are?

    I checked the Options-> memory, but it says nothing about the use of the memory on the SIM card and the other figures indicates that the BB itself has of course plenty of room/memory left.

    I don't want to delete SMS' are all 2 days... Someone has a good idea on how to check the status of the real of the SIM memory?

    Concerning

    Finnerup

    Follow these steps-

    1. Options
    2. SMS text
    3. Leave Messages on SIM card: no
  • Want my iPhone and Apple Watch both ding when I get a text / SMS message.

    My wife has a watch and iPhone 5 s and she wants SMS / text messages from the watch or the phone to beep.

    Is there a way to do this? If not, is there a way to make sure it's always the ringing telephone, even if the watch is connected?

    The way this works is that the watch will replace the phone for most of the alerts. So if the watch is connected, you will get alerts on the iPhone.

  • BlackBerry Z10 Do not receive SMS Messages in my charger to 2013 with Uconnect

    I have a Z10 paired with my charger of 2013 with uConnect (RE2).  I can make calls, but I don't get notification of SMS messages through the system.  My old Curve 9360 used to work properly with my Grand Caravan 2012 and uconnect for texting.

    Is there an incompatibility between BB10 and uconnect?

    10.2.1.1925 OS version

    I have no way of knowing... I don't have a UConnect system, do not not an identical experience. But on my Honda Civic, 2013, everything comes through in the car very well display/voice system. Thus, one could guess that indeed there is an incompatibility between your specific UConnect system and your specific version of the BB10... but, as the KB has suggested to, check the compatibility of Chrysler could be a useful thing to do for you.

    Good luck!

  • BlackBerry Smartphones Messages folder displays only e-mails not SMS messages.

    Hello, I just changed a Pearl to a Curve 8900 and I'm having a bit of trouble getting the same functuionality.

    My messages folder only shows emails I sent and received and not SMS or MMS messages that I've sent and received.  This means that when I receive a TEXT Message, I have to go in the main Blackberry screen and highlight the icon 'SMS and MMS' but I think I should be able to access the SMS messages sent/received from the "Messages" icon on the home screen.  I can create the "Messages" icon SMS messages, but they do not stay there after that that they were sent.

    I could have explained this poorly, but any help would be popular.  The only thing I did to try a fix is pull on the battery, to no avail.

    Thank you

    Hi and welcome to the forums!

    On the Blackberry go to the queue main, menu, options, general, options.

    Scroll to SMS and Email in the boxes, select handset. Now SMS will appear in the main queue

    (You have described very well!)

    Thank you

    Bifocals

  • How to get existing sms messages

    Is there a way to get the already reveived sms messages that are in the Inbox. I am familiar with the available headphone model but I need to be able to get messages that are already in the Inbox.

    Not available in API, and I never found a way to do it.

  • get information from the sms message

    How to get information from sms

    ex: 1. the sender's phone number

    2. sms text

    Check the interface messages and methods like getAddress(), text, getPayLoadText.

  • How do you get SMS messages to text App?

    Hey guys,.

    By mistake I have authorized Google Hangouts back my SMS messages, but now I want to go back to the application of the text, how can I do?

    Thank you.

    In my view, the steps are open Hangouts, select Menu > settings > SMS and there is the option to enable / disable the SMS.

  • How to get the list of sms messages

    How do I enumerate the sms messages?

    Folder.List () does not work

    You cannot access the SMS messages on the device.

  • Recieved SMS message don't show up as a preview/banner

    Hi guys, my xperia z3 new compact arrived today, but I'm having some trouble

    I want my phone displays a banner that scrolls down from the top of the screen when I receive a text message sender and message alert name post content (such as banners on iphone) phones me that I have a new SMS message, this banner should I show when I use

    currently when I receive a message all get alert me is the noise of message, an icon on the top of the phone, but not banner

    After searching the forums, I believe some users call it a preview of the message, I always called him a notification banner and I'm not sure of the exact term

    a friend has the same phone and its been on the box, so I know that it is possible

    to confirm this, a new phone with the only apps installed are those that come pre installed

    and in my messenger app > "notifications" settings are turned on

    and in settings > sound & notification > notifications app > "block" is not enabled, and 'priority' is messaging

    any help or ideas would be greatly apreciated

    Liam

    I think the difference here is the versions of software in your phones (or perhaps the e-mail application used). The old version with Android 4.4 you will see name of shippers without drag down the notification bar but in Android 5/5.1 you will need to slide down the notification at the top bar to see a preview when using our messaging app. But if you go to Hangouts for SMS you need not slide down. Open meeting places and go to settings-> SMS-> SMS disabled to switch to meeting places.

  • Response of blackBerry Smartphones cannot SMS messages

    Any SMS messages that I received today let me answer them. Whenever I want to send a response that I had to start a completely new SMS. Type an answer then press Enter has no effect, and type an answer then press the Blackberry button (to get the menu up to select 'send' to) do not work either.

    Messages in my phone yesterday and besides are to be found, and I can respond to them in the usual way.

    Info on the device

    T Mobile

    BlackBerry 8520 / 5.2.0.67

    Apps and free space

    The only Apps I have installed are Facebook and Twitter and AppWorld.

    I solved it myself my take out the battery and put back in. The score.

  • BlackBerry smartphones to create a new folder of message for SMS messages

    Can anyone help.

    Looking at my SMS messages using the message icon. The only problem is that you see emails as well...

    If I go to 'See the folder' and select SMS Inbox, I get SMS messages display.

    Y at - it anyway to set this view of folder by default when I open the message icon.

    Hi and welcome to the forums,

    You can separate messages. Go to the menu of queue message SMS of OPTIONS - GENERAL OPTIONS - AND EMAIL BOXES

    Select distinct.

    Please let me know if this can help,

    Thank you.

  • BlackBerry Smartphones have to register on my computer sms messages

    How can I save a lot of sms messages on my computer?

    I believe that the only way is to make a backup of the SMS with the DTM, then get a 3rd party software called ABC Amber BlackBerry Converter

    allows you to open and extract the contents of the backup file

  • Display default blackBerry Bold 9700 Smartphones SMS messages

    Hello

    I have a new 9700 "BOLD", after having a curve that is intuitive and easy to use.

    I'm trying to get the default folders to the SMS display show only SMS messages in my Inbox SMS (ie the SMS I received) but it seems to show either only the SMS I sent (SMS to send view) or a combination of received and sent messages.

    Help please?

    Thank you

    Well, that's interesting, I've had something similar with my Inbox do not separate.

    Try this.

    Change the no option > save > change backward for Yes > save/quit > pull the battery and then send a test text yourself and see if it helps.

Maybe you are looking for