×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    4

    SMS API With 3410

    With 3410 one can send messages to another 3410 mobile using a different port no...But is it possible that by writing a stand-alone java application or by writing a servlet or jsp one can send messages to a 3410 mobile using the port no at which a j2me application running inside the mobile is ready to receive a message.. I know many api through which We can send a message from java to the inbox a cellphone but i dont know how to send a message from a java program to a j2me application using the nokia sms api using some port no .....

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003
    Posts
    382

    RE: SMS API With 3410

    Hello

    Here is some information how to write midlet that can listen the
    port number for incoming messages.

    Address part of the message:
    defines is connection working in :
    ?client? mode for sending:
    String addr = ?sms://+358401234567?; //recipient
    String addr = ?sms://+358401234567:6578?;

    server? mode for receiving:
    String addr = ?sms://:5432?; //local port nr.
    MessageConnection conn = (MessageConnection)Connector.open(addr);


    PORT NUMBERING:

    The port numbers in the SMS are used to address the recipient MIDlet in the phone
    If a message is sent without a port number, it is a ?normal? SMS message and it will go to the normal SMS inbox and
    it will be shown normally to the recipient

    A MIDlet can reserve a port number (or several port numbers) for its own messages
    messages sent to the port number of the MIDlet will be delivered directly to the MIDlet and they should not be shown to the end user as normal messages

    A server that responds to received messages:
    try {
    String addr = ?com.nokia.sms://:5432?;
    MessageConnection conn = (MessageConnection) Connector.open(addr);
    Message msg = null;
    while (someExitCondition) {
    // wait for incoming messages
    msg = conn.receive();

    // received a message
    if (msg instanceof TextMessage) {
    TextMessage tmsg = (TextMessage)msg;
    String receivedText = tmsg.getPayloadText();
    // respond with the same text with ?Received:?
    // inserted in the beginning
    tmsg.setPayloadText(?Received:? + receivedText);
    // Note that the recipient address in the message is
    // already correct as we are reusing the same object
    conn.send(tmsg);
    } else {
    // Received message was not a text message, but e.g. binary}
    }
    } catch (Exception e) {?}

    The SMS can be sent from anywhere, and if the message has gsm number and port number to where it is sent to.
    Then I can be received by the MIDLet which is listening that certain port number.

    You can also use WMA, wireless messaging API with 3410 by upgrading the latest software to your 3410, to send and receive SMS messages

    I hope this helps you.

Posting Permissions

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