×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Dec 2006
    Posts
    2

    SMS send confirmation

    Dear All,

    I have Nokia 2610 and I am developing a midlet for SMS send, I have the following code:

    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;

    import javax.microedition.io.Connector;
    import javax.wireless.messaging.*;

    public class WmaSend extends MIDlet implements CommandListener
    {
    Display display;
    Form mainForm;
    MessageConnection conn;
    TextMessage tmsg;

    Command sendCmd = new Command("Send", Command.SCREEN, 1);

    Command exitCmd = new Command("Exit", Command.EXIT, 1);

    TextField address = new TextField("Address: ", "", 200, TextField.PHONENUMBER);

    ChoiceGroup typeSelect = new ChoiceGroup("Messagetyp: ", Choice.EXCLUSIVE, new
    String[] {"Text","Binary"}, null);

    TextField port = new TextField("Port:", "", 5, TextField.ANY);

    TextField text = new TextField("Text:", "This is a example SMS.", 160, TextField.ANY);

    public WmaSend()
    {
    display = Display.getDisplay(this);
    mainForm = new Form("WmaSend");
    mainForm.append(address);
    mainForm.append(port);
    mainForm.append(typeSelect);
    mainForm.append(text);
    mainForm.addCommand(sendCmd);
    mainForm.addCommand(exitCmd);
    mainForm.setCommandListener(this);
    }

    public void commandAction(Command c, Displayable d)
    {
    if(c == sendCmd)
    {
    try
    {
    String addr = "sms://" + address.getString() +
    ((port.getString().length() == 0) ? "" : ":" +
    port.getString());

    try {
    conn = (MessageConnection)Connector.open(addr);
    } catch (Exception ioe) {
    ioe.printStackTrace();
    Alert alert = new Alert("IOError !");
    alert.setString("SMS not send. IOError: " +
    ioe.toString());
    display.setCurrent(alert, mainForm);
    }

    if(typeSelect.getString(typeSelect.getSelectedIndex()).equals("Text")) {
    try {
    tmsg = (TextMessage)conn.newMessage(MessageConnection.TEXT_MESSAGE);
    tmsg.setPayloadText(text.getString());
    } catch (Exception e2) {
    Alert alert = new Alert("SendErroe !");
    alert.setString("Sms not send. CreateError: " +
    e2.toString() + " " + conn.toString());
    display.setCurrent(alert, mainForm);
    }

    try {
    conn.send(tmsg);
    conn.close();
    } catch (Exception e1) {
    Alert alert = new Alert("SendErroe !");
    alert.setString("Sms not send. SendError: " +
    e1.toString());
    display.setCurrent(alert, mainForm);
    }
    } else if(typeSelect.getString(typeSelect.getSelectedIndex()).equals("Binary")) {
    BinaryMessage bmsg = (BinaryMessage)conn.newMessage(MessageConnection.BINARY_MESSAGE);
    bmsg.setPayloadData(text.getString().getBytes());
    conn.send(bmsg);
    conn.close();
    }
    } catch (Exception e) {
    e.printStackTrace();
    Alert alert = new Alert("Error !");
    alert.setString("SMS hallo not send. Error: " +
    e.toString());
    display.setCurrent(alert, mainForm);
    }

    address.setString("");
    port.setString("");
    text.setString("");
    } else {
    notifyDestroyed();
    }
    }

    public void startApp()
    {
    display.setCurrent(mainForm);
    }

    public void pauseApp()
    {

    }

    public void destroyApp(boolean unconditional)
    {

    }

    }

    But each time I send an SMS I get a confirmation from the phone asking whether to send the message or not (it looks like the mobile is handling the message sending process), how can i pass it without confirmation?

    Thanx
    Last edited by nizarhandal; 2007-01-21 at 11:49.

  2. #2
    Super Contributor
    Join Date
    Nov 2003
    Location
    Bangalore , India
    Posts
    4,429

    Re: SMS send conformation

    Hi nizarhandal! Welcome to Nokia Discussion Boards!!

    In order to avoid these permission messages, you have to sign your application.

    Here is a similar discussion regarding permission messages.
    http://discussion.forum.nokia.com/fo...hlight=signing

    Regards
    Gopal

    __________________
    MobiQuil.com
    An initiative by Developers for Developers.
    http://www.mobiquil.com - Alpha - Launched.

Similar Threads

  1. Replies: 2
    Last Post: 2007-11-10, 13:19
  2. can i send SMS automatically?
    By vhepeter2005 in forum General Messaging
    Replies: 3
    Last Post: 2007-04-28, 09:23
  3. chinese sms send solution!
    By serverclient2004 in forum General Messaging
    Replies: 0
    Last Post: 2005-06-03, 06:36
  4. Replies: 1
    Last Post: 2002-07-23, 14:39

Posting Permissions

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