06-18-2009 01:34 PM
I've just started doing work with making apps and have been trying out lots of stuff. Right now I'm trying to write an application that can send an SMS message to a given number, is this possible?
I've been reading all through the docs and I found an SMS sample code file but it doesn't seem to help. They start listeners and send messages and stuff but how do I specify where the message is to be sent?
I am using the Blackberry JDE version 4.7 right now.
Any help on this topic would be greatly appreciated.
Thanks in advance,
09-29-2009 07:42 AM
If you're referring to the smsdemo shipped with the BlackBerry plugin, the example sends the message to the number specified by the user in the EditField (private EditField _sendText
If you want to send the message to a single (fixed) number, you can either hard code it or specify it in a resource file.
Here's a code sample to help you.
String smsAddress = "9876543210";
String smsText = "Hi, this is my first sms";
MessageConnection messageConnection = (MessageConnection) Connector.open("sms://" + smsAddress);
TextMessage sms = (TextMessage)messageConnection.newMessage(MessageC