×

Discussion Board

Results 1 to 1 of 1
  1. #1
    Regular Contributor
    Join Date
    Nov 2006
    Location
    Rajkot
    Posts
    430

    Error in Open MessageConnection....

    Hi all

    when i send simple SMS at open connection time it will stop do nothing not give any error or not give any message only receive WARNING in this situation please help me.

    Warning: To avoid potential deadlock, operations that may block, such as
    networking, should be performed in a different thread than the
    commandAction() handler.

    when i stop that content highligth with PINK color

    For better understanding my problem i put the code:

    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.io.*;
    import javax.wireless.messaging.*;
    import java.io.*;
    import java.lang.*;
    import java.util.*;

    public class WMAClient extends MIDlet implements CommandListener, MessageListener
    {
    private Command exitCommand; //The exit commands
    private Command sendMsgCommand; //Command to get Message
    private Display display; //The display for this MIDlet

    Form displayForm;
    String msgToSend="Can you hear me?";
    MessageConnection clientConn;

    public WMAClient()
    {
    display = Display.getDisplay(this);
    exitCommand = new Command("Exit", Command.SCREEN, 1);
    sendMsgCommand = new Command("Send", Command.SCREEN, 1);
    }

    public void notifyIncomingMessage(MessageConnection conn)
    {
    }
    public void startApp()
    {
    displayForm = new Form("Send Message");
    displayForm.addCommand(exitCommand);
    displayForm.addCommand(sendMsgCommand);

    displayForm.setCommandListener(this);
    display.setCurrent(displayForm);
    }

    public void pauseApp() { }

    public void destroyApp(boolean unconditional) { }

    // Respond to commands.
    public void commandAction(Command c, Displayable s)
    {
    if (c == exitCommand)
    {
    destroyApp(false);
    notifyDestroyed();
    }
    if (c == sendMsgCommand)
    {

    try
    {
    System.out.println("Before Connection");
    clientConn = (MessageConnection)Connector.open("sms://+5550000:5000");
    System.out.println("Open Connection");
    clientConn.setMessageListener(this);
    }
    catch(Exception e)
    {
    e.printStackTrace();
    }
    try
    {
    TextMessage tmsg = (TextMessage)clientConn.newMessage(MessageConnection.TEXT_MESSAGE);
    System.out.println("PayLoadText: " + msgToSend);
    tmsg.setPayloadText(msgToSend);
    clientConn.send(tmsg);
    }
    catch (Exception e)
    {
    e.printStackTrace();
    }

    }
    }
    }

    Regards
    Tanya
    Last edited by Tanya; 2006-12-28 at 12:03.

Similar Threads

  1. XHTML : File open Error
    By as_vijay_anand in forum Browsing and Mark-ups
    Replies: 0
    Last Post: 2006-09-19, 06:36
  2. Eclipse : How to open a project ?
    By coliban in forum Mobile Java Tools & SDKs
    Replies: 2
    Last Post: 2006-06-26, 16:18
  3. Replies: 3
    Last Post: 2005-10-12, 05:26
  4. game doesn't open when tried to open it on 7650
    By venugujjeti in forum Mobile Java General
    Replies: 1
    Last Post: 2005-02-15, 11:53
  5. Open various file's...
    By andreas84 in forum Symbian
    Replies: 1
    Last Post: 2003-10-27, 16:28

Posting Permissions

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