SMS for outgoing SMS listener throws IOException immediately after the open call

I had already created a class for sending SMS messages which worked perfectly until I added the listener. When the listener is added as soon as I start the thread throws an IOException exception who am I hurting? The only thing I can think is some kind of wire problem, please help.

Here's the SMS & Listener class:

private static final class SmsMessage    {        private String _address;        private String _msg;

        public SmsMessage(String address, String msg)        {            _address = address;            _msg = msg;        }

        public Message toMessage(MessageConnection mc)        {            TextMessage m = (TextMessage)mc.newMessage(MessageConnection.TEXT_MESSAGE,"sms://" + _address);            m.setPayloadText(_msg);            return m;        }    } // SmsMessage

   private final class SendThread extends Thread    {        private static final int TIMEOUT = 500; // ms        private Vector _msgs = new Vector(10); // Queue of 10        private volatile boolean _start = false;

        // queue requests        public synchronized void send(String address, String msg)        {            _start = true;            _msgs.addElement(new SmsMessage(address, msg));        }

        public synchronized void stop()        {            _stop = true;            try {                if ( _mc != null ){                    _mc.close();                }            } // catch (IOException e ) {                catch (Throwable t) {                t.printStackTrace();                System.exit(0);            }

        }

        public void run()        {            try {                //closed by the stop() method                _mc = (MessageConnection)Connector.open("sms://");

                if (_mc != null)                {                    // set a listener to trap outgoing sms messages                    _mc.setMessageListener(new OutboundSMSListener());                }                for(;;)                {                    while( !_start && !_stop)                    {                        try {                            sleep(TIMEOUT);                        } // catch (InterruptedException e) {                            catch (Throwable t) {                                t.printStackTrace();                                System.exit(0);                            }                    }                    if ( _stop )                    {                        return;                    }

                    while(true)                    {                        try {                            SmsMessage sms = null;                            synchronized (this)                            {                                if ( !_msgs.isEmpty() )                                {                                    sms = (SmsMessage)_msgs.firstElement();                                    // take it out of the queue once we sent it                                    _msgs.removeElement(sms);                                }                                else                                {                                    _start = false;                                    break;                                }                            }

                            _mc.send(sms.toMessage(_mc));

                        } // catch (IOException e) {                            catch (Throwable t) {                                t.printStackTrace();                                System.exit(0);                        }                    }                }            } // catch (IOException e)              catch (Throwable t) {                t.printStackTrace();                System.exit(0);              }        }    } // SendThread

    private static final class OutboundSMSListener implements OutboundMessageListener    {        public void notifyIncomingMessage(MessageConnection messageconnection)        {            // we don't care about incoming sms messages right now        }

        public void notifyOutgoingMessage(Message message)        {            Dialog.alert("Detected An Outgoing SMS Event");        }    }

Thank you. Makes sense.

Tags: BlackBerry Developers

Similar Questions

  • How to create a task that runs once a day, immediately after the opening of session?

    Hello, I'm wondering how to create a task using the Task Scheduler that runs once a day, immediately after I have logon.

    The reason is I want to use Bing Desktop to change my wallpaper every day. However, I just want to run the first time I start my computer every day, so it will change the wallpaper. By default, it starts whenever I have to logon. It's annoying, because I just want it to start once a day to change the wallpaper. However, using the Task Scheduler, I put only a trigger to start "at the opening of session' or"once a day." If I choose once per day, it runs about 5-10 min after I login, instead of logon immediately after. If I choose the two triggers, then it starts after each session.

    Basically, I just want the Task Scheduler to launch the program after the connection the first time I connect to the computer on any given day. How can I do this?

    Hello Jeffrey,.

    You can refer to the links below and see if that helps.

    Create a task

    http://TechNet.Microsoft.com/en-us/library/cc720110 (v = WS.10) .aspx

    Modify a scheduled task

    http://TechNet.Microsoft.com/en-us/library/cc778308 (v = WS.10) .aspx

    Change an existing task

    http://TechNet.Microsoft.com/en-us/library/cc766442.aspx

    Please write back to us for assistance and we will be happy to help you come.

    Thank you

  • CC gel Lightroom CC crashing immediately after the opening

    all my Adobe CC does not work as if it were a complete mess, I'm super irritated because not all of my settings were transferred in the which versions updates were released and I try to make everything synchronized. I don't have 4 versions of photoshop on my system or 2 versions of lightroom. I need a fix that keeps all my settings and destroys any additional programs that I don't need. the creative cloud app does not load my application page it just freezes, I spent a whole day trying to fix it myself without success and need help. also the cc lightroom does not open he crashed after the startup screen every time. I am beyond frustrated.

    Hi Shannon,

    Please uninstall the old applications using the information below:

    Uninstall or change a program - Windows help

    OS X Yosemite: install, update and uninstall applications

    and for the rotation of the wheels on the applications tab:

    * Please complete all Adobe (Windows) Task Manager process & Activity Monitor (Mac)

    Try the solutions below

    Adobe Creative Cloud desktop application does not open or shows a spinning wheel of progress

    Kind regards

    Chirag

  • Each CC application closes immediately after the opening

    Hey there

    I've seen this question asked over and over again, with a different answer, most of the time. When I run any application CC (i.e. DW & Photoshop), they close right after I finished loading. One notable exception is Lightroom... but of course, this isn't lightroom I need right now.

    -J' deleted my previous installation of the CS6, even removed the flash drive. CCleaner ran twice including several rebbots. Fresh from any Adobe stuff.

    -I don't have Growl installed on my system.

    -J' signed, in/out/in, the creative cloud app.

    -J' tried different installation location.

    -J' tried all THE PLUGS and no ceiling for my login.

    I got my 1 year subscription paid in advance; It's Friday night and I'm VERY upset that I don't have work to do!

    Can someone please?

    Greg

    Hey there I'm sorry to hear that you are faced with the same pb.

    Let me save you hours with the support of the queue. You will not fix it. Simple.

    The only thing that worked was to reimage my system. On a new installation it worked immediately. It's painful, but it's really much faster than the time I spent trying to rootcause with the support of the people on the phone.

    Once he's behind you, things are good.

  • Newly installed adobe reader stops immediately after the opening

    I just installed Adobe Reader (on a Windows 7 computer), but I tried to open it it starts and stops immediately. I have another PDF generator that came with the computer (Stat Nova PDF) which could interfere with Adobe reader.

    Works with Adobe reader installed or PDF software.

    Is there a setting to make Adobe default PDF reader?

    I can't risk to uninstall the software original PDF (Stat Nova PDF), it must be for a rush job and can't risk have no functional PDF reader at all.

    Thanks for your help

    First thing to try: go to C:\Program Files (x 86) \Adobe\Reader 11.0\Reader and Eula.exe execution, and then click I accept.

  • Safari closes immediately after the opening

    When I click on the Safari browser icon, it begins to open and you can see start the browser. However, he left immediately again.

    It could be that your Safari preferences has been corrupted.

    Try this:

    In the Finder menu bar, click on - access the folder

    type or copy paste the following text:

    ~/Library/preferences/com. Apple.Safari.plist

    Click OK, and then move the com.apple.Safari.plist file to the trash.

    Quit and restart the Safari app.

    I hope this helps.

  • Crash applications Windows 8 immediately after the opening

    None of the Windows 8 applications will load completely.

    After clicking on an application, the loading screen appears for about a second, and then it returns to the menu (metro).
    I still see these apps as open in the left bar.
    This happens at all in the menu (metro), wait for the office and Internet Explorer.
    I installed Windows 8 two days ago, and everything was working fine until today.
    My screen resolution is 1920 x 1080, and my graphics card drivers are up to date.
    Does anyone know how to fix this?
    Thank you
    -Mario
    Additional information:
    • * Sound Windows 8 Pro, 64-bit version.
    • I made a new user, it was working fine the fist few restart, then suddenly apps stopped working. Has no install/change anything.

    Hey guys, this is a solution for those that the regular methods of Microsoft did not.
    In case you're all players like me (Yes a "gamer" of shop windows, hilarious DL) and you have an AMD GPU, here is my solution:
    I've tinkered a bit with the graphics settings in the CCC (Catalyst Control Center) in order to work some mods on my Skyrim. Without knowing it at the time, he did my regular apps don't work. After that I turned the return parameters, everything is back to normal. So here is my solution (for those with AMD. In case you have an Invidia-good for you and I have no idea where are the menus):
    1. open the CCC, on the left, you will see many options (Pinned, Presets, office management, etc..) Go to the games tab, and then press "3D application settings.
    2. do not be nervous with what you see, it's ok. Located at the bottom of the page, you can find a black button with 'Default' about this. PRESS THE KEY, THEN APPLY.

    That should do the trick. Hope this helps :)
    Dr_Ellert
    E-mail address is removed from the privacy *.

  • Photo Viewer crashes immediately after the opening

    Windows 8 - Photo Viewer crashes after opening.  Yes it's been updated. No I don't monkey with all the settings.

    Thank you all for your comments.  It was very appreciated.

    SOLUTION: delete the app and re-installed.  Problem solved

    Thanks again for the help...

  • Glitches immediately after the opening

    When I try to open Acrobat, I get this screen:

    Screen Shot 2015-10-22 at 10.12.28 AM.png

    I guess it's supposed to be a welcome screen, but he did and said nothing. I can't click away and can't I click on the acrobat behind her screen. I can't literally do anything in Acrobat. I can't even Quit Acrobat, but am left with force leaves the it.

    I'm on a Mac of Yosemite. (FYI - in the case where it is a Mac-specific error)

    Does anyone else have this problem? No one knows how to fix?

    I just saw this answer and it works for me:

    To help isolate the problem, can you please give some info:

    1. are you using a Setup dual monitor (retina with a non-retina display perhaps?)

    2 have you installed Acrobat DC using creative cloud for Mac?

    3 have you tried to hit the "Esc" key on your keyboard. In case it does not work, please try it with the button "Enter" first and then "Esc".

    After you complete step 3, you should be able to freely use Acrobat. This dialog box should not appear again. If Acrobat is not usable even after executing step 3, we know. We may have to dig a little deeper to the root cause.

    Mustapha

    Adobe Systems

  • CC of Photoshop closes immediately after the opening

    Same problem as many. Photoshop Lightroom bundle. Running Windows 8.1. Bridge and Lightroom work but photoshop stops after starting upwards.

    Can open a picture of the bridge but then prompted to save before closing down.

    I tried all the suggestions on the forums about newspaper inside and outside creative cloud about reinstalling etc.

    Issue is resolved by the application of a change in security for total control users in the folder Adobe followed by an uninstall and reinstall the program. Seems to have had a permissions problem.

  • Please let us put code immediately after the < head >

    I need some space

    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    

    Just after the opening < head > tag.   This tag only works when it is placed immediately after the opening < head > tag.

    I need this because I need to replace how some internal networks against Internet Explorer. Without this tag all my muse sites are detailed on our internal network. I guess that many networks of companies would have the same configuration.  It's really frustrating to have to put it manually on every page whenever I export my Muse site.

    Is there a way to get around this?

    Interesting.

    It is impossible within the Muse to add the code that appears earlier in the HTML content.

    Given that it is an intranet site and apparently all content must be edge mode, you might consider to change the configuration of the server configuration of web servers to specify the modes of document (Internet Explorer)>.

  • SignalExpress closes immediately after the splash screen

    I'm having a problem with the Software NI SignalExpress where the application fails to open completely - it closes immediately after the splash screen. I am using windows XP Pro. SP3.

    I tried to uninstall, registry errors compensation and reinstall, I also tried the repair installation - or who work.

    A test of SignalExpress installation was installed on my PC until I got a full copy with the purchase of a data acquisition (usb-6218).

    Hi André,.

    Sounds a bit nasty. If repairing and reassembling and all this malarky does not recommend the use of msiblast to clean your computer of all the software of NOR and starting again with a new install. When you software uninnstall he didn't get rid of everything, there is still hidden folders around dootted.

    I joined msiblast.exe.

    -Run msiblast

    -Make sure the radio button "Show OR installers only" is selected.

    -Select all and then click on uninstall.

    When this is complete, your computer will be NOT free. After that;

    -Install all software from OR you for example LabVIEW Signal express

    -Then install the drivers. The USB-6218 case uses the DAQmx driver that the latest version can be downloaded from this link.

    If it persists then write again.

    Kind regards

  • Vuze will close immediately at the opening after the download again.

    I got Vuze and it worked fine on my Vista laptop, until completely, he crashed and burned yesterday.  So I tried to install on my desktop, in the meantime.  Now, after the installation/uninstallation, repeat, repeat, Vuze closes immediately after I open it to run.  I tried to uninstall and reinstall a Zillion times and keep getting the same thing.  No code error, nada.  I'm so frustrated I could go postal, but love Vuze'm so willing to keep trying, with your help, hopefully.  Thank you in advance and Yes, I'm a newb.  Sorry, kids.  I appreciate greatly any help.

    Have you tried right clicking on the shortcut to the program or the .exe and select "Run As Administrator"?  Perform, even if your user name is an administrator.  If there is no difference, see if the following help.

    Have you tried to clean your Temp folder, you can do this by typing folder in the Start Menu RUN box.  This will open your Temp folder, there, you can remove all Windows will allow you to do.

    It may be necessary to show both hidden and system files and also uncheck 'Hide known file types' in Control Panel / folder Options / view to navigate to the mentioned location of Temp.

    Once more uninstall Vuze.

    To return your machine to a sense of normalcy after than multiple installs and uninstalls (who can have left pieces in all directions), try to use system restore to revert to before you first installed the program.

    How to repair the operating system and how to restore the configuration of the operating system to an earlier point in time in Windows Vista (or 7)
    http://support.Microsoft.com/kb/936212/#appliesTo

    Also try running ChkDsk to check your drive for errors. Right click on your drive icon / properties / tools / error checking.  Try first by checking do not each box (that it will run in read-only mode) to see if it reports any problems file or hard drive.  If so, restart it by checking both boxes and restart to allow him to attempt to fix any problems found.

    After running the cleaning go for a new facility using this approach.  Temporarily turn off all running programs of type security such as real-time virus scanners during installation.

    Right-click on the Setup.exe, and select the option "Run As Administrator"?  Perform, even if your user name is an administrator.

    I'm not familiar with Vuze, that's the kind of program that must be allowed by the firewall that you have?

    Panel\All Control Panel Items\Windows Firewall\Allowed programs

  • MU computer stops immediately after the start-up or attempts repeated; So sometimes minutes after;

    The computer stops immediately after the start, repeatedly or a few minutes after have managed to start it. The error log showed two evenys:

    (1) the service Acquisition of Image Windows (WIA) suspended at startup; (2) the server {81ED811 A1F4E726-8CF1 - 11 D 1-BF92-00600} is not registered with DCOM within the required time.  After restarting the computer, and after installing all of the updates, I installed the last printer; I unplugged the printer and the computer booted immediately!  Does anyone have suggestions, and if I have to update the drivers (hp Laser jet 5 p & hp scanjet 5370C;) How? Please help, frustration to a max; Thank you very much; HeinrichDS

    HeinrichDS

    Recommendation of the Palcouk of sense what is the operating system and is worth a try.  If you're still having problems, then you need to talk to specialists in XP (because it is a Forum for Vista).  In this case, please transfer your question in the Forums of XP to http://social.answers.microsoft.com/Forums/en-US/category/windowsxp where the XP experts will be happy to help you.

    Good luck!

    Lorien - MCSA/MCSE/network + / has + - if this post solves your problem, please click the 'Mark as answer' or 'Useful' button at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • Flickering of screen (pulse) immediately after the start

    Hello

    I use Adobe Creative Cloud. Immediately after the departure of Photoshop CC (2015) the screen is flickering (pulse black and white).

    The same problem occurs with InDesign CC (2015) and Illustrator CC (2015) (I do not try other products). I can create a new file (with CTRL + N), the new file is opened, no flackering more is seen... but, in the background, the "pulse" is always present. So I can not for example open a menu or work without pulling hair. During the flackering, the mouse moves very slowly, that the processor is loaded to 100%!

    It seems the app want to display a splash screen, but cannot.

    I updated all the drivers... try the different settings (GPU)... without success.

    • Adobe applications are the latest
    • Laptop Lenovo Thinkpad T540p, Intel Core i5 - 4200 M 2.50 GHz
    • Windows 7, 64-bit
    • RAM: 4 GB
    • Graphics card: Intel HD 4600 graphics card
    • The graphics driver version: 10.18.14.4332 (latest version) / date: 20.11.2015
    • Screen resolution: 1920 x 1080, true color (32 bit), 60 Hz

    Someone an idea?

    Thank you

    Hello

    Greetings!

    Right click on photoshop and choose Run as administrator.

    Now, try

    Concerning

    Jitendra

Maybe you are looking for