You Are Here:

Community: Developer Discussion Boards

#1 Old send sms from 3410 - 2003-05-16, 10:01

Join Date: Mar 2003
Posts: 10
Location: South Africa
Send a message via MSN to johanmeyer
johanmeyer
Offline
Registered User
Hi
I am a java developer from South Africa. I am trying to write a sms midlet using the NOKIA 3410 api and emulator. But up to now I could not get my application to work.

here's my code:

public class SMS1000 extends javax.microedition.midlet.MIDlet {
public void startApp() {
System.out.println("start");
sendBookMark();
System.out.println("end");
}

public void pauseApp() {
}

public void destroyApp(boolean unconditional) {
}


public void sendBookMark() {
String gsm_number = "0833024749" ;

try {
String addr = "com.nokia.sms://"+gsm_number;
System.out.println("start connection");
MessageConnection conn = (MessageConnection)Connector.open(addr);
System.out.println("conn made");
TextMessage msg = (TextMessage)conn.newMessage(MessageConnection.TEXT_MESSAGE);
msg.setPayloadText("test sms");
conn.send(msg);
System.out.println("msg send");
}catch(Exception e) {
System.out.println(e);
}
}
}

The code compiles without any problems. But as soon as the midlet tries to make the connection to send the sms it throws an IOException. And I tried everything to get it to work but I had no luck. I would really appreciate it if you could help me.

You can email me: johan.meyer@intec.co.za
Reply With Quote

#2 Old 2003-05-16, 14:30

Join Date: Mar 2003
Posts: 382
jalev's Avatar
jalev
Offline
Forum Nokia Expert
Hello


It would be good to use constructor in your code,
and make also high level UI komponent that has a command send.

Here is the send method which should work.

public void sendBookMark() {

String Pnumber = "123";
String Message ="Message";

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

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

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

msg.setPayloadText(Message);

conn.send(msg);

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

Remember to import all necessery libraries:

import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
import com.nokia.mid.messaging.*;
import javax.microedition.io.*;

Download the latest vesion of 3410 SDK from forum nokia web pages.

I hope this helps you
Reply With Quote

#3 Old 2003-05-19, 16:44

Join Date: Mar 2003
Posts: 10
Location: South Africa
Send a message via MSN to johanmeyer
johanmeyer
Offline
Registered User
I managed to solve my problem. All I needed to do was to upgrade my cellphone's software. I am currenlty running version V05.06 of the NOKIA 3410 software and the SMS application is working perfectly.
Reply With Quote

#4 Old Nice to know there are other Mobile developers in South Africa... - 2003-05-20, 08:06

Join Date: Mar 2003
Posts: 12
Psychocrackpot
Offline
Registered User
Glad ya solved your problem....

You are the first South African I've come across in the forum. This is just a friendly HI! and Good Luck with your mobile developments...
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