×

Discussion Board

Results 1 to 7 of 7

Thread: SMS Api

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    5

    SMS Api

    Hi

    I have tried the example shown in the SMS API, but the 3410 phone only returns the error "p" which seems to be a rather common error-report.

    Could someone please help me on how the SMS api is used ?

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    9

    RE: SMS Api

    Hi,
    did you (or anyone else) find a solution to this - we too have this problem and can't figure out what is going on with the phone - so far I've not heard anyone actually succeed in sending an SMS. If anyone _can_, please say so.

    Ta
    p

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    9

    RE: SMS Api

    Hi,
    did you (or anyone else) find a solution to this - we too have this problem and can't figure out what is going on with the phone - so far I've not heard anyone actually succeed in sending an SMS. If anyone _can_, please say so.

    Ta
    p

  4. #4
    Registered User
    Join Date
    Mar 2003
    Posts
    12

    RE: SMS Api

    hello
    not sure about waht i m going to say but i m trying to help you.
    SMS API is not yet implemented, the JSR 120 corresponding is in Final Approval Ballot on the 19th of August 2002.....it is going to be implemented soon i think.
    http://jcp.org/jsr/detail/120.jsp
    http://www.wirelesssoftware.info/show1news.php/235.html
    that means partial implementation can already exist.(where can we find it ?)

    Niko

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    25

    RE: SMS Api

    The 'p' error you're getting is due to a bug in the implementation on the phone. You'll need to get it upgraded to version 4.09 or higher at your Nokia service centre. Nokia's implementation of the SMS API is very close to that proposed in JSR 120, so hopefully not much of a rewrite will be required once the standard is implemented.

  6. #6
    Registered User
    Join Date
    Mar 2003
    Posts
    31

    RE: SMS Api

    i'm wondering how you've done anything with SMS Api,

    I just see a bunch of html pages explaining Nokia SMS API(Nokia_SMS_API_v0.9.zip) but no jar/classes whatever ...

  7. #7
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Rennes, France
    Posts
    50

    RE: SMS Api

    hi,

    you're right there's no such jar/class files but only the html pages. But If you look the API, it's composed of 5 interfaces so you can write the code by yourself and put them in the good package.
    For that, you'll need 5 different files:

    //file1: BinaryMessage.java
    package com.nokia.mid.messaging;

    public interface BinaryMessage extends Message {
    byte[] getPayloadData();

    void setPayloadData(byte[] data);
    }

    //file2: Message.java
    package com.nokia.mid.messaging;

    public interface Message {
    String getAddress();

    void setAddress(String addr);

    java.util.Date getTimestamp();
    }

    //file3: MessageConnection.java
    package com.nokia.mid.messaging;

    public interface MessageConnection extends javax.microedition.io.Connection {
    int TEXT_MESSAGE = 1;
    int BINARY_MESSAGE = 2;

    Message newMessage(int type);

    Message newMessage(int type, String address);

    void send(Message msg) throws java.io.IOException, java.io.InterruptedIOException;

    Message receive() throws java.io.IOException, java.io.InterruptedIOException;

    void registerMessageListener(MessageListener l) throws java.io.IOException;
    }

    //file4: MessageListener.java
    package com.nokia.mid.messaging;

    public interface MessageListener {
    void notifyIncomingMessage(MessageConnection conn);
    }

    //file5: TextMessage.java
    package com.nokia.mid.messaging;

    public interface TextMessage extends Message {
    String getPayloadText();

    void setPayloadText(String str);
    }

    After, you can test the API with that program. Some version of the phone doesn't work. This program runs with the version v4.09

    /*
    * SendSMS.java
    *
    * Created on 12. elokuuta 2002, 13:54
    */

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

    import com.nokia.mid.messaging.MessageConnection;
    import com.nokia.mid.messaging.TextMessage;

    /**
    *
    * @author fred
    * @version
    */
    public class SendSMS extends MIDlet implements CommandListener {

    private Form form;

    private Display display;

    private Command exit;
    private Command ok;

    public void startApp() {
    display = Display.getDisplay( this );
    form = new Form("Send message"
    form.append("Do you want to send the message?"
    ok = new Command("Send",Command.OK,2);
    exit = new Command("Exit",Command.EXIT,1);
    form.addCommand(ok);
    form.addCommand(exit);
    form.setCommandListener( this );
    display.setCurrent( form);
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }

    public void send() {
    String gsm_number = "041123456";

    try {

    String addr = "com.nokia.sms://"+gsm_number;

    MessageConnection conn = (MessageConnection)Connector.open(addr);

    TextMessage msg = (TextMessage)conn.newMessage(MessageConnection.TEXT_MESSAGE);

    msg.setPayloadText( "This is a test" );

    conn.send(msg);

    form = new Form("Send message"
    form.append("Message sent"
    exit = new Command("Exit",Command.EXIT,1);
    form.addCommand(exit);
    form.setCommandListener( this );
    display.setCurrent( form );


    }catch(Exception e) {
    form = new Form("Error"
    form.append("Some error"
    exit = new Command("Exit",Command.EXIT,1);
    form.addCommand(exit);
    form.setCommandListener( this );
    display.setCurrent( form );
    }

    }

    public void commandAction(Command command, Displayable displayable) {
    if(command == ok){
    send();
    }
    if(command == exit){
    destroyApp( true );
    notifyDestroyed();
    }
    }

    }

    Frdric

Posting Permissions

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