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: 66
Registered: ‎01-14-2010
My Device: 8700
My Carrier: Airtel

Sending SMS through Java

Hello All

 

Can somebody share me the code for sending SMS programatically?

 

Thanks

Sudhakar Chavali

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Sending SMS through Java

I remember seeing some in the KB, the forum or in the developer guide.  I suggest you review those three places. 

Developer
Posts: 71
Registered: ‎06-26-2009
My Device: Curve 8310

Re: Sending SMS through Java

Totally agree, this question has come up here a few times.

 

A few possible solutions:

 

1. This thread I posted a solution to this problem - http://supportforums.blackberry.com/t5/Java-Development/Programmatically-send-SMS-for-particular-GSM...

2. The Search button above would help.

3. There is a KB with an example.

4. There is an example in the API docs as well.

 

Please search before posting, there are numerous resources on this.

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.

Developer
Posts: 66
Registered: ‎01-14-2010
My Device: 8700
My Carrier: Airtel

Re: Sending SMS through Java (Failing on 8330 device)

Hello Peter/icefrost

 

Thank you for the post.

My requirement is sending SMS automatically to other phone without user intervention. Hence I don't want to use default application to be invoked that comes with Blackberry.

 

I have tested the SMS code using WMA way and RIM API way as explained at http://myhowto.org/java/j2me/22-sending-and-receiving-gsm-sms-on-blackberry-using-rim-apis/

 

Also some discussions at

http://supportforums.blackberry.com/t5/Java-Development/Unable-to-send-SMS-on-Verizon-device/m-p/215...

http://www.blackberryforums.com/developer-forum/62055-unable-send-sms-j2me-application-blackberry-87...

 

 

The code is working fine when I have tested on 8700 series. But for 8330 it is throwing exception (at customer end). Unfortunately I don't have 8330 to test.

 

After further investigation on google, what I understand is people were discussing on CDMA and GSM enabled SMS features. Also they are asking to to use DatagramConnection instance instead of MessageConnection instance. Tried all the ways based on the various KBs and internet discussions. But no luck. :-(

 

Here are the different ways

 

mc=(MessageConnection) Connector .open("sms://" + phone);

TextMessage m = (TextMessage) mc.newMessage(MessageConnection.TEXT_MESSAGE, "//" + phone);
                    m.setAddress("sms://" + phone);
                    m.setPayloadText(buffers.elementAt(i).toString());                  
                    mc.send(m);

 

======================================================

 

smsConnection = (DatagramConnection) Connector.open("sms://:0");
SmsAddress destinationAddr = new SmsAddress("//" + phone);

Datagram d = smsConnection.newDatagram(completePayload.length);
((DatagramBase) d).setAddressBase(destinationAddr);
d.setData(completePayload, 0, completePayload.length);
smsConnection.send(d);

 

=======================================================

 

tried below methods also

smsConnection = (DatagramConnection) Connector.open("sms://"+phone+":0");

smsConnection = (DatagramConnection) Connector.open("sms://"+phone");

 

 

 

So I am really not sure what will be causing issue for sending SMS using 8330 mobile.

 

Can you please help me on how to resolve this issue?

 

Thanks

Sudhakar Chavali

 

Highlighted
Developer
Posts: 133
Registered: ‎07-20-2009
My Device: Not Specified

Re: Sending SMS through Java

There is a sample in the JDE samples , which is called smsdemo, You may take a look on that one

Developer
Posts: 66
Registered: ‎01-14-2010
My Device: 8700
My Carrier: Airtel

Re: Sending SMS through Java

Hi

 

I have already done much investigation on that. I am able to send SMS using 8700 mobile but getting exception on 8330. Please see my previous post.

 

Thanks

Sudhakar Chavali

 

Developer
Posts: 66
Registered: ‎01-14-2010
My Device: 8700
My Carrier: Airtel

Re: Sending SMS through Java

Hello All

 

Any help please on how to send SMS on iDEN and CDMA networks?

 

Thanks

Sudhakar Chavali