You Are Here:

Community: Developer Discussion Boards

#1 Old Where to get SMS lib for 3410? - 2002-07-26, 15:00

Join Date: Mar 2003
Posts: 17
Dess
Offline
Registered User
Hi,

I downloaded the Nokia SMS API zip archive on nokia site but there's only doc in that file. Where are these interfaces implemented? I'm using the Nokia developer suite for 6310i and there's no such interface in it (it's normal because only 3410 supports them atm)

TIA,
D.
Reply With Quote

#2 Old RE: Where to get SMS lib for 3410? - 2002-07-31, 06:51

Join Date: Mar 2003
Posts: 382
jalev's Avatar
jalev
Offline
Forum Nokia Expert
Hi,
I hope this will help you,

In Nokia 3410 which is the only Nokia Java mobile that support
sending sms messages from Java application can be programmed as shown below.

Import following files.

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

To have package or files needed to have your project compiled,
you need to create files by following how they are documented in Nokia SMS API. And put that self made classes in to
your source directory in a way that they are in SMS API. After this following code sample should
compile without errors.


Below is also example of NOKIA SMS API INTERFACES:

this is the function you need for sending SMS from MIDlet:

public void send()
{
String gsm_number = 040123123

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

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

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

msg.setPayloadText("some text to be sent");

conn.send(msg);

}catch(Exception e)
{
System.out.println(e);
}

}


These are the files needed to compile your SMS MIDlet

NOKIA SMS API INTERFACES

File com/nokia/mid/messaging/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;
}



File com/nokia/mid/messaging/Message.java



package com.nokia.mid.messaging;

public interface Message
{
String getAddress();

void setAddress(String addr);

java.util.Date getTimestamp();
}



File com/nokia/mid/messaging/TextMessage.java


package com.nokia.mid.messaging;

public interface TextMessage
extends Message
{
String getPayloadText();

void setPayloadText(String str);
}




File com/nokia/mid/messaging/BinaryMessage.java



package com.nokia.mid.messaging;

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

void setPayloadData(byte[] data);
}




File com/nokia/mid/messaging/MessageListener.java



package com.nokia.mid.messaging;

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

When creating MIDLet suite, these Interface files are not nesessery to take in to the JAR packet, because they are implemented into the 3410.

I hope this will help you developing SMS MIDlets Nokia for 3410.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

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

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia