Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
icefrost1
Posts: 71
Registered: ‎06-26-2009
My Device: Curve 8310
Accepted Solution

Outgoing SMS disappears into thin air

Hi

 

I'm sending an SMS from my application, but nobody's getting it. No exceptions are thrown and all results are expected, except no SMS arrives.

 

I'm opening my connection as follows:

 

 

c = (MessageConnection) Connector.open("sms://:0"); c.setMessageListener(this);

 

 Then later in my code, I try to send an SMS:

 

 

TextMessage txtMessage = (TextMessage) c.newMessage(MessageConnection.TEXT_MESSAGE); txtMessage.setAddress("sms://" + number); txtMessage.setPayloadText("Test"); c.send(txtMessage);

 

 number is the number in international format (number is of type final String). The second part is called from inside a new thread that's started from the callConnected implementation of a PhoneListener. Something like this:

 

 

public void callConnected(int id) { // spawn new thread with above code and start() it }

 

 If I don't spawn the thread I get a dispatch thread exception. The above code generates no errors, but no SMS either.

 

Somebody can make a suggestion?

 

Regards

 

Lionel

 

 

 

Give kudos if somebody helps you, also mark accepted if it solves your problem. Search first, then post. Please respect RFC-1855 when posting on forums.

Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: Outgoing SMS disappears into thin air

Have you tried using the standard SMS code, as supplied in the KB article?

 

There are a few othe SMS related KB articles you might want to review.  So a search of the KB, here:

http://www.blackberry.com/knowledgecenterpublic/livelink.exe

Please use plain text.
Developer
icefrost1
Posts: 71
Registered: ‎06-26-2009
My Device: Curve 8310

Re: Outgoing SMS disappears into thin air

Hi

 

Thanks for your info once again, I actually just figured it out. SMS code works fine, but number was "", sorry for my ignorance.

 

Regards

 

Lionel

Give kudos if somebody helps you, also mark accepted if it solves your problem. Search first, then post. Please respect RFC-1855 when posting on forums.

Please use plain text.
New Contributor
hhamaky
Posts: 8
Registered: ‎07-26-2010
My Device: Not Specified

Re: Outgoing SMS disappears into thin air

Hi,

I was trying to make an app in which we write an sms and sends it to that number 0000000000

so that i can see the incoming message in the simulator inbox and i used that code

 

MessageConnection msgConn = (MessageConnection)Connector.open("sms://"+"0000000000");
                Message msg = msgConn.newMessage(MessageConnection.TEXT_MESSAGE);
                TextMessage txtMsg = (TextMessage)msg;
                txtMsg.setPayloadText("Test Message");
                Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, new MessageArguments(txtMsg));

I successfully receive the message in inbox but i recieve it empty.

 

and when i use that code

MessageConnection msgConn = (MessageConnection)Connector.open("sms://"+"0000000000");
                Message msg = msgConn.newMessage(MessageConnection.TEXT_MESSAGE);
                TextMessage txtMsg = (TextMessage)msg;
                txtMsg.setPayloadText("Test Message");
                msgConn.send(txtMsg);

                msgConn.close();

 

nothing occurs at all.

 

I am new in java programming so would anyone please help me in this.

 

Regards

Hassan El-hamaky

 

Please use plain text.