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

Reply
Developer
ahmadahmad
Posts: 404
Registered: ‎05-31-2011
My Device: curve

access to sent sms

hiii, is there a method to access the outbox SMS, or listening to sent SMS if yes how to do?

 

Please use plain text.
Developer
PoojaMaheshwari
Posts: 141
Registered: ‎02-10-2010
My Device: 9500

Re: access to sent sms

Add OutboundMessageListener to achieve this. Add this listener using the API call: MessageConnection.setMessageListener

 

Refer to this link:

http://www.blackberry.com/developers/docs/4.6.0api/net/rim/blackberry/api/sms/OutboundMessageListene...

 

Please use plain text.
Developer
ahmadahmad
Posts: 404
Registered: ‎05-31-2011
My Device: curve

Re: access to sent sms

thanks, but do u have an example how to use it?
Please use plain text.
Developer
hemak
Posts: 97
Registered: ‎10-06-2009
My Device: Not Specified

Re: access to sent sms

OutboundMessageListener helps you listen outgoing messages,But net.rim.blackberry.api.sms.SendListener will allow you to decide whether to send the outgoing sms or block it.You have to implement this interface and implement the method boolean sendMessage(Message message). In this method If you return true, message will be sent,else it will not be sent.
Please use plain text.
Developer
ahmadahmad
Posts: 404
Registered: ‎05-31-2011
My Device: curve

Re: access to sent sms

thanks for explanation but do you have some code for more understanding!?
Please use plain text.
Developer
BeroboInc
Posts: 123
Registered: ‎07-08-2011
My Device: Torch 9800, Bold 9700

Re: access to sent sms

You can use something like this for listening to outgoing sms

 

 

public class MyMessageListener implements OutboundMessageListener

{

public void notifyOutgoingMessage(javax.wireless.messaging.Message m)

{

try {        

String msg = null;               

msg = getMessage(m); // my call to convert Message to String                        

... process msg       

}       

catch(Exception ex)        {}

}
}

 

// to register the listener

 

MyMessageListener ml = new MyMessageListener();

MessageConnection mc;

try {

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

mc.setMessageListener(el);

}catch (Exception e){}

Berobo Inc.
Police Scanner Radio / Alarm Clock lets you listen to Police scanners in your area!
http://www.berobo.com
_________________________________________________
Please click the Like button to thank the user that has helped you and
please mark post as solved when you have found the solution to your problem.
Please use plain text.
New Contributor
gopalanrc
Posts: 9
Registered: ‎01-18-2011
My Device: Not Specified

Re: access to sent sms

Hi,

        I tried OutboundMessageListener. But i'm not getting notified when an SMS is sent from device. I used port '0'. Can you help me in anyother way?

Please use plain text.