-
October 4th, 2011, 01:27 AM
#1
SMS Application
Hello,
I am building the java SMS API. whenever i run on the hardware then i get the following error.
------------------------------------
Start SMS example application.......
------------------------------------
will wait for network registration...
End wait for network registration...
exception : java.io.IOException: send SMS error : cause select = 0x10 cause =
0x1
what might be the cause of this error?
-
October 4th, 2011, 12:24 PM
#2
Re: SMS Application
Hi,
what platform are you developing on?
-
October 5th, 2011, 05:22 AM
#3
Re: SMS Application
Hi,
Me running the application its working. mean to say it can recieve the sms but not send the sms.
can u tell whts the error in the following code:
System.out.println("will wait for network registration...");
Thread.sleep(18000);
System.out.println("End wait for network registration...");
/* ******************************************************************************** */
/* SEND A MESSAGE */
/* ******************************************************************************** */
/* Use a String for the receiver number */
String addr = "sms://+7760534592";
/* Create a Message Connector */
MessageConnection msgConnect = (MessageConnection) Connector.open(addr);
/* Create the message */
TextMessage msg = (TextMessage)msgConnect.newMessage(MessageConnection.TEXT_MESSAGE);
if (addr!= null)
msg.setAddress(addr);
msg.setPayloadText("Hello world");
/* Send the message (blocking call) */
System.out.println("sending hello world");
System.out.println("msg" +msg);
System.out.println("msgconnect" +msgConnect);
msgConnect.send(msg);
System.out.println("sent hello world");
/* ******************************************************************************** */
/* RECEIVE A MESSAGE (blocking way) */
/* ******************************************************************************** */
/* Reference on the received message */
Message receiveMsg = null;
System.out.println("Try to receive the message");
/* Try to receive the message */
receiveMsg = msgConnect.receive();
/* check if we receive a text message */
if ( receiveMsg instanceof TextMessage)
{
TextMessage txtMsg = (TextMessage) receiveMsg;
String receiveTxt = txtMsg.getPayloadText();
System.out.println("Received text : " + receiveTxt);
}
/* Received message wasn't a text one... */
else
{
/* Manage here the message (which wasn't a text one) */
}
/* ******************************************************************************** */
/* RECEIVE A MESSAGE (no blocking way) */
/* ******************************************************************************** */
/* Create a listener class which implement the MessageListener interface */
/* ********************************************************************* */
class myListennerClass implements MessageListener
{
public void notifyIncomingMessage(MessageConnection messageconnection)
{
System.out.println("Message received : ");
Message msg;
try {
/* Get the message */
msg = messageconnection.receive();
/* Check message type */
if (msg instanceof TextMessage )
{
System.out.println(((TextMessage)msg).getPayloadText());
}
else
{
System.out.println("not a text message");
}
} catch (InterruptedIOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
/* Create the listener */
MessageListener myListener = new myListennerClass();
msgConnect.setMessageListener(myListener);
} catch (Exception e) {
/* Add here the exception management */
System.out.println("exception : "+ e);
}
/* Wait few minutes in order to receive messages */
Thread.sleep(360000);
}
}
-
October 6th, 2011, 02:59 PM
#4
Re: SMS Application
I canĀ“t see any obvious problem. The two things I can think about is if the connection string is ill formted or if the program is not having the right permissons.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|