Symbian
Symbian OS Library

[Index][spacer]



 

Classification: Java Category: J2ME Wireless Messaging API
Created: 09/23/2004 Modified: 10/18/2004
Number: FAQ-1142
Platform: Symbian OS v7.0s, Symbian OS v8.0, Symbian OS v8.0a, Symbian OS v8.0b

Question:
How can I send an SMS message using the Wireless Messaging API so that it is received in the recipient's inbox?

Answer:
To send a SMS message so that it is received in the inbox of the target phone (as opposed to another application) do not specify a port number in the SMS address. Code to send the SMS message would therefore look something like this.


    String address = "sms://+447111222333";
    MessageConnection smsconn = null;
    try {
    smsconn = (MessageConnection)Connector.open(address);
    TextMessage txtMessage = (TextMessage)smsconn.newMessage(MessageConnection.TEXT_MESSAGE);
    txtmessage.setPayloadText("Hello World");
    smsconn.send(txtMessage);
    smsconn.close();
    } catch (Exception e) {
    //handle
    }

    Also see FAQ-1141 How can I send an SMS message using the Wireless Messaging API so that it is received by a specific MIDlet?