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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 526
Registered: ‎05-17-2009
My Device: 9900
My Carrier: ATT

Sending SMS through Messages Application?

Hey guys heres my issue,

 

I know we cant access the message store for SMS, but I would like the messages I am sending through my app to end up in the sent list in the SMS inbox. I also know that I could invoke the messages app with the arg_new_sms arguments. If i do it this last way is there a way to send the message after invoking without the SMS app ever showing itself to the user?

 

Any help is appreciated, thanks guys

Like all of my posts
Developer
Posts: 526
Registered: ‎05-17-2009
My Device: 9900
My Carrier: ATT

Re: Sending SMS through Messages Application?

any body got any ideas?
Like all of my posts
Developer
Posts: 432
Registered: ‎02-23-2009
My Device: Not Specified

Re: Sending SMS through Messages Application?

You can use SMSPacketHeader for this

 


Press the kudos button to thank the user who helped you.

If your problem was get solved then please mark the thread as "Accepted solution".

 

 

Deepesh Gupta
Developer
Posts: 526
Registered: ‎05-17-2009
My Device: 9900
My Carrier: ATT

Re: Sending SMS through Messages Application?

Thanks deepesh ill give it a look, see if i can get it working.
Like all of my posts
Developer
Posts: 432
Registered: ‎02-23-2009
My Device: Not Specified

Re: Sending SMS through Messages Application?

Sure and If your problem was get solved then please mark the thread as "Accepted solution".

 

 

Deepesh Gupta
Developer
Posts: 526
Registered: ‎05-17-2009
My Device: 9900
My Carrier: ATT

Re: Sending SMS through Messages Application?

Ok after looking at it for the past hour or so i dont know if im exactly sure how I would use it.

 

I have something like this that ive tried to no luck.

 

 

TextMessage out = (TextMessage)_send.newMessage(MessageConnection.TEXT_MESSAGE); SmsAddress a = new SmsAddress(); a.setAddress(add); int[] b = new int[1]; b[0]=0; SMSPacketHeader ph = new SMSPacketHeader(); ph.setMessageCoding(SMSPacketHeader.RECORD_STATUS_MS_ORIGINATED); out.setAddress(a.makeAddress(true,ph,b)); out.setPayloadText(messages[j]);

 I would then assume i could send through messagconnection, but this gives me an illegal argument exception at a.setAddress(add) where add is a string with a phone number "2345678912".

 If you might be able to point me down the right path thatd be greatly appreciated, or if I am headed down the right path do you see something I may be missing

 

thanks again,

Kyle

 

 

Like all of my posts
Highlighted
Developer
Posts: 432
Registered: ‎02-23-2009
My Device: Not Specified

Re: Sending SMS through Messages Application?

Try with this piece of code. I have not tested on it but it will surely help you

 

 

MessageConnection mc = (MessageConnection)Connector.open("sms://"); TextMessage textMessage = (TextMessage)mc.newMessage(MessageConnection.TEXT_MESSAGE); textMessage.setAddress("sms://" + number); Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, new MessageArguments(textMessage));

 

 


Press the kudos button to thank the user who helped you.

If your problem was get solved then please mark the thread as "Accepted solution"

 

 

 

 

Deepesh Gupta
Developer
Posts: 526
Registered: ‎05-17-2009
My Device: 9900
My Carrier: ATT

Re: Sending SMS through Messages Application?

OK yea I have that but I want to be able to either send that or save it without the user actually seeing the SMS app. Would key injection be the best way? Thanks again for the help deepesh
Like all of my posts
Developer
Posts: 432
Registered: ‎02-23-2009
My Device: Not Specified

Re: Sending SMS through Messages Application?

I tried it with email; i created a message object and add that message object in sentfolder using store/folder but no idea about sms insertion.

 

 


Press the kudos button to thank the user who helped you.

If your problem was get solved then please mark the thread as "Accepted solution".

 

 

 

Deepesh Gupta
Developer
Posts: 526
Registered: ‎05-17-2009
My Device: 9900
My Carrier: ATT

Re: Sending SMS through Messages Application?

ok I ended up just saving the messages in the messages app as an email using this code...

 

 

Session session = Session.getDefaultInstance(); Store store = session.getStore(); Folder[] folders = store.list(Folder.SENT); Folder sentfolder = folders[0]; net.rim.blackberry.api.mail.Message msg = new net.rim.blackberry.api.mail.Message(sentfolder); msg.setContent(kyle.getText()); msg.setStatus( net.rim.blackberry.api.mail.Message.Status.TX_SENT, net.rim.blackberry.api.mail.Message.Status.TX_MAILBOXED); msg.setSentDate(new Date(System.currentTimeMillis()));
sentfolder.appendMessage(msg);

 This works great on almost every device, except the 8330, does anyone have any idea why it would not work?

The messages dont save at all when the code works well on every other simulator in the 4.5 jde except the 8330?

 

 

Like all of my posts