BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 08-02-2007, 10:51 AM   #1 (permalink)
New Member
 
Join Date: Aug 2007
Model: 7100v
PIN: N/A
Carrier: Airtel
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default SMS protocol problem

Please Login to Remove!

Hi everyone.
I am new to BlackBerry Development. I want to send SMS from my application. I have used BlackBerry DatagramConnection API's and It is working fine, whenever there is GPRS connection. I want to do the same without GPRS connection as normal SMS technology works.

Plz Can anyone help me in this issue?

Thanks in Advance.

Raghav
Offline  
Old 08-02-2007, 10:59 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

Well my decision for the problem is...

Code:
MessageConnection conn = null;
      TextMessage text = null;
      try {
        conn = (MessageConnection) Connector.open("sms://");
        conn.close();
        text = (TextMessage) conn.newMessage(MessageConnection.TEXT_MESSAGE);
        text.setPayloadText("message");
      } catch (IOException e) {
        Dialog.alert("Exception: " + e);
      }
      Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, new MessageArguments(text));
With this code the system sms application for sending SMSs is opened and the body is "message" and you should choose the number you want and SEND it
Offline  
Old 08-03-2007, 04:01 AM   #3 (permalink)
New Member
 
Join Date: Aug 2007
Model: 7100v
PIN: N/A
Carrier: Airtel
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default SMS invoke problem

Hi,
Thanks for the reply. It worked fine but i need to send sms, without any interfearence. I have an static message to send and this process should be automated without invoking system SMS application.
Thanks in Advance.
with regards,
Raghav.
Offline  
Old 11-13-2007, 05:29 AM   #4 (permalink)
Thumbs Must Hurt
 
Join Date: Oct 2007
Location: chennai.india
Model: 8100
PIN: N/A
Carrier: airtel
Posts: 57
Post Thanks: 0
Thanked 0 Times in 0 Posts
Arrow Error while sending

hi pa4o85

i use your sample code but my application shown this error
"Error Starting Sendsms MOdule "SendSms"attempts to accessa secure Api"
how to solve this type of errors is my application need signing?
Offline  
Old 11-13-2007, 07:06 AM   #5 (permalink)
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

the correct code to send a sms directly is as follows,
number is a string with the phone number of the target device,
msg a string with the message you want to send.

Code:
MessageConnection _dc = (MessageConnection)Connector.open("sms://"+number);                 
Message sms = _dc.newMessage(MessageConnection.TEXT_MESSAGE);
TextMessage sms2 = (TextMessage)sms;
sms2.setPayloadText(msg);    
_dc.send(sms2);
this is using a secure api, you need to sign your code using the $100 signing key.
be sure to use this inside an own thread.

@pa4o85: your code is a bit strange. you open a connection just to close it in the next line... and why would you want to create a message manually when you invoke the sms-application anyhow?

hth,
simon
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 11-15-2007, 01:35 AM   #6 (permalink)
Thumbs Must Hurt
 
Join Date: Oct 2007
Location: chennai.india
Model: 8100
PIN: N/A
Carrier: airtel
Posts: 57
Post Thanks: 0
Thanked 0 Times in 0 Posts
Arrow Sms Protocal Problem

hi pa4o85 thanks for your reply

i fix my problem i already added that No string but i didnt sign my application thats why my Application asking permission .... i want to create a message connection for device boot up time my application want to start automatically in every bootup how to Autostart my sms application is? i use Jde Autostart Properties but it wont work is it need Signing ?
Offline  
Old 05-13-2008, 11:31 PM   #7 (permalink)
Knows Where the Search Button Is
 
Join Date: Nov 2007
Model: 8800
PIN: N/A
Carrier: Airtel
Posts: 20
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I was able to send the message without gprs also using Datagram connection.

But the message reaching the recipient is junk ..I think it is going as binary or some part of UDH is getting messed up.
This is the code i use .
Code:
	DatagramConnection dc = 
				(DatagramConnection)Connector.open("sms://"
						               +message.GetDestAddress());
			
       Datagram d = dc.newDatagram(dc.getMaximumLength());
			
	d.setData(msgText[i].getBytes(), 0, msgText[i].length());
        dc.send(d);
Can anyone throw some more light on it .??
__________________
Thanks
Amit

Last edited by airan : 05-13-2008 at 11:39 PM.
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





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