×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Feb 2011
    Posts
    15

    Question Sending SMS on exiting of Midlet

    Hello Friends,
    I want to add utility in which Whenever user tries to Exit (Either from exit command or Pressing END(Red End Button on Phone)), I want to send sms on one Number. So, I tried to Add sms code in destroyApp() function. Here the code is,
    Code:
    public void destroyApp(boolean unconditional) {
           
                    try {
                        String s = "sms://0000000000";  // 10 Digit Valid Mobile Number
                        textField = getTextField();
                        textBox_Summary = getTextBox_Summary();
                        String msg = textField.getString().trim() + " " + pid.toString() + " " + textBox_Summary.getString();
                        MessageConnection mc = (MessageConnection) Connector.open(s);
    
                        System.out.println(mc.toString());
                        TextMessage tm = (TextMessage) mc.newMessage(MessageConnection.TEXT_MESSAGE);
                        tm.setPayloadText(msg);
                        mc.send(tm);
                        notifyDestroyed();
                    } catch (Exception e) {
                     e.printStackTrace();
                        //  exitMIDlet();
                    }
           
        }
    This code is working fine in defaultConfiguration.
    But when I try to run in Series 40 6th Edition Emulator or In real Nokia device, its not working.
    In Emulator, I am getting this error :
    Code:
    Using Trusted simulated domain
    Exception: java/lang/ClassNotFoundException
            at com.sun.midp.io.InternalConnector.openPrim(+135)
            at com.sun.midp.io.InternalConnector.open(+9)
            at javax.microedition.io.Connector.open(+6)
            at javax.microedition.io.Connector.open(+6)
            at javax.microedition.io.Connector.open(+5)
            at pkg.com.log.ONOFFAPP1.destroyApp(+78)
            at javax.microedition.midlet.MIDletProxy.destroyApp(+8)
    com.nokia.mid.impl.isa.io.protocol.external.sms.Protocol@d590dbc
    Then what should I do that this works? I tried to change Security Option of Nokia Midlet, but that was also not worked.

    Thanking You,
    Hakoo Desai.

  2. #2
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: Sending SMS on exiting of Midlet

    Are you using some Nokia specific API, if yes then which one?
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  3. #3
    Registered User
    Join Date
    Feb 2011
    Posts
    15

    Re: Sending SMS on exiting of Midlet

    No, I am using purely J2ME APIs.

  4. #4
    Registered User
    Join Date
    Dec 2009
    Posts
    376

    Re: Sending SMS on exiting of Midlet

    AFAIK the problem is occuring because midlet getting destroyed soon before sending SMS,instead of putting code in destroy app ,when user presses exit send sms first and after that ,in the function call destroy app
    Last edited by prssupe; 2011-05-31 at 15:46.

  5. #5
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Thumbs up Re: Sending SMS on exiting of Midlet

    Try not exiting the app on Series 40 6th Edition Emulator or In real Nokia device, as I guess the Nokia S40 device will be asking for the confirmation for exting the MIDlet to the user.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

Similar Threads

  1. Replies: 3
    Last Post: 2009-07-06, 12:46
  2. Sending SMS from MIDlet causes error in sending normal sms's
    By hparkar in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2008-12-25, 10:02
  3. Sending SMS from MIDlet causes error in sending normal sms's
    By hparkar in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2008-12-24, 13:36
  4. Simulation of SMS receiving/sending on S40 emulator
    By pgoyal in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2008-10-17, 05:33
  5. App exiting on issuing a number of HTTP POST Requests.
    By sukla in forum Symbian Networking & Messaging (Closed)
    Replies: 3
    Last Post: 2007-05-08, 08:29

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×