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
Contributor
NicholasAStuart
Posts: 12
Registered: ‎09-14-2010
My Device: Not Specified

Close MessageConnection

What is the prefered way of sending SMS's?

 

                            mc = (MessageConnection) Connector.open("sms://+" + Number + ":" + Port);
                            tm = (TextMessage) mc.newMessage(MessageConnection.TEXT_MESSAGE);
                            tm.setAddress(localNumber);
                            tm.setPayloadText(message.getMessage());
                            mc.send(tm);
                            mc.close();

 

Is how I do it, but when I do I get

 

Error: java.lang.IllegalArgumentException: invalid destination address: must begin with sms:// or //

 

from the mc.send() line, but I'm not sure why. I assume it's the mc.close(), but how else am I supposed to close the sender after a message is sent.

Please use plain text.
Developer
trainee
Posts: 237
Registered: ‎05-07-2010
My Device: 8520
My Carrier: Internet

Re: Close MessageConnection

just remove "." after Number.

___________________________________________________
please press kudos(star button on left) if this post is helpful to you
"Accept as solution" if your query has been resolved.@hitendra
_________________________________________________
Please use plain text.
Developer
trainee
Posts: 237
Registered: ‎05-07-2010
My Device: 8520
My Carrier: Internet

Re: Close MessageConnection

please ignore earlier post.

 

 i have faced same problem as you.

 

when i have removed port it works fine.

 

so just tried it.

 

 

thankx.

___________________________________________________
please press kudos(star button on left) if this post is helpful to you
"Accept as solution" if your query has been resolved.@hitendra
_________________________________________________
Please use plain text.