How to send /receive SMS using the siemens tool kit
Rishi Tyagi
Ranch Hand
Joined: Feb 14, 2002
Posts: 100
posted
0
Hi everybody, i want to make an application for the siemens sl45i model which can send and receive sms using phone existing connection. I tried with the SMS class given in ....gsm package of smtk API but failed . What i have done is : 1- i made an application which uses method in SMS class of the API given by siemens for sending the sms. 2- i run this application on sl45i and m50 emulators. 3- my computer is connected with the internet using DSL Network I received the following error while running the application java.io.IOException Now My question is :- 1- Is there any other setting is to be done for running the application in emulator. 2- What are the differences are to be made in the aspplication before running the application on the real phone.
I will be really thankfull if anybody can help at this problem Thanks in advance Rishi
sameet more
Greenhorn
Joined: Dec 19, 2001
Posts: 10
posted
0
For sending sms u erquire a sim card.i tested it on the actual device and thru it u can send sms but cannot recieve it
sameet more <P>wireless java programmer
Rishi Tyagi
Ranch Hand
Joined: Feb 14, 2002
Posts: 100
posted
0
Dear Sameet, Thanks for the help extended. But still there is one problem. Now i copied the programme into the real phone through data exchange software while running the application it gives SMS.send(String,String) method returns 18 means 18 characters sent. but the message never reach to the destination. Could you please help me what could be the reason for this problem? I am just writing my code here below.
//****************code starts*********** import javax.microedition.midlet.*; import javax.microedition.lcdui.*; import javax.microedition.io.*; import com.siemens.mp.gsm.*; public class sms1 extends MIDlet implements CommandListener { private Form form; private Command cmdOk,cmdExit; private TextFieldmsg; public sms1() { } public void startApp() { Display d=Display.getDisplay(this); form=new Form("Send SMS"); msg=new TextField("Dest No",null,160,2); cmdOk=new Command("Send",Command.SCREEN,0); cmdExit=new Command("Exit",Command.SCREEN,0); form.append(msg); form.addCommand(cmdOk); form.addCommand(cmdExit); form.setCommandListener(this); d.setCurrent(form); } public void pauseApp(){} public void destroyApp(boolean b){} public void commandAction(Command c,Displayable d) { if(c==cmdOk) { int rep=0; String err_msg=""; try{ String dest_no=msg.getString(); dest_no=dest_no.trim(); rep=SMS.send(dest_no,"test from j2me app"); msg.setLabel(""+rep); }catch(Exception e) { err_msg="error :"+e.getMessage(); System.out.println("error :"+e); e.printStackTrace(); } } else if(c==cmdExit) { notifyDestroyed(); } } }
sameet more
Greenhorn
Joined: Dec 19, 2001
Posts: 10
posted
0
Well the problem with ur code is create an object of the SMS class SMS sms = new SMS(); then use this object to send the sms sms.send("string","string")