BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 07-16-2007, 10:36 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: May 2007
Location: Bulgaria
Model: none
PIN: N/A
Carrier: Mtel
Posts: 150
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Can you tell me a way to send sms with specified text ?

Please Login to Remove!

I hava an application and i need to open the sms system application and put there the text i want from my application and just choose the number and send it. The dificulty here is that i can open the sms system application with empty field for the text, but i need to fill this field with hard code text specified from my application.Thank You !!!
Offline  
Old 07-17-2007, 06:23 AM   #2 (permalink)
Thumbs Must Hurt
 
Join Date: May 2007
Location: Bulgaria
Model: none
PIN: N/A
Carrier: Mtel
Posts: 150
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

So that is a piece of code that i use to send a sms to a friend for example with this number...I catch the event of the trackwheel (clicking the "Send SMS" button) and i tried to invoke the system application of BB to send the sms with this text "some text"...the problem is that i need TextMessage object which constructor get a String as it is the text message...i get an instance of TextMessage like this...here is the code i use:

public boolean trackwheelClick(int status, int time, Field field) {
if (((CustomButtonField) field).getLabel().equals("Send SMS")) {
MessageConnection conn =
(MessageConnection) Connector.open(number);
TextMessage sms =
(TextMessage) conn.newMessage(MessageConnection.TEXT_MESSAGE);
sms.setPayloadText("Some text");
Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES,
new MessageArguments(sms));
}
return true;
}
Offline  
Old 07-17-2007, 07:17 AM   #3 (permalink)
Thumbs Must Hurt
 
Join Date: May 2007
Location: Bulgaria
Model: none
PIN: N/A
Carrier: Mtel
Posts: 150
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

so the problem is that i can not instantiate the TextMessage object....i tried to implement the TextMessage class but it is not working that way too...here is the code:

SMS sms = new SMS();
sms.setPayloadText("some text");
Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, new
MessageArguments(sms));


the class that implements TextMessage:


class SMS implements TextMessage {

public SMS() {
super();
}

public String getPayloadText() {
// TODO Auto-generated method stub
return null;
}

public void setPayloadText(String arg0) {
}

public String getAddress() {
// TODO Auto-generated method stub
return null;
}

public void setAddress(String arg0) {
// TODO Auto-generated method stub
}

public Date getTimestamp() {
// TODO Auto-generated method stub
return null;
}

}

Help me some way !
Offline  
Old 07-17-2007, 08:07 AM   #4 (permalink)
Thumbs Must Hurt
 
Join Date: May 2007
Location: Bulgaria
Model: none
PIN: N/A
Carrier: Mtel
Posts: 150
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

The problem is fixed....This code is working properly. If someone needs a functionality like this i post the code:

MessageConnection conn = null;
TextMessage text = null;
try {
conn = (MessageConnection) Connector.open("sms://");
conn.close();
text = (TextMessage) conn.newMessage(MessageConnection.TEXT_MESSAGE);
text.setPayloadText("some text");
} catch (IOException e) {
Dialog.alert("Exception: " + e);
}
Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, new MessageArguments(text));
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

(C21) Genuine OEM Apple AC Cord
$25.0
(C21) Genuine OEM Apple AC Cord picture Vintage OEM Apple Design Powered Speakers M2497 Rainbow Logo Used Works
$39.0
 Vintage OEM Apple Design Powered Speakers M2497 Rainbow Logo Used Works pictureLau W89-252 OEM Replacement Condenser Fan Blade Fixed Hub
$61.81
Lau W89-252 OEM Replacement Condenser Fan Blade Fixed Hub pictureLau W89-251 OEM Replacement Condenser Fan Blade Fixed Hub
$121.52
Lau W89-251 OEM Replacement Condenser Fan Blade Fixed Hub pictureOriginal OEM APPLE Airport Extreme Base Station Power Supply AC Adapter A1202
$14.6
Original OEM APPLE Airport Extreme Base Station Power Supply AC Adapter A1202 picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.