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
r4j
New Contributor
Posts: 3
Registered: ‎06-10-2012
My Device: 9530T
Accepted Solution

How to block sending SMS from BlackBerry in code

I tried to use notifyOutgoingMessage from interface OutboundMessageListener to catch sending SMS but it doesn't work. From the document, I can see it only give a copy of message. So, I wonder how can I catch sending SMS and block it in code? This is my try:

 

MessageConnection _mc = (MessageConnection) Connector.open("sms://:0");
_mc.setMessageListener(new OutboundSMSListener());
private static final class OutboundSMSListener implements OutboundMessageListener
{
public void notifyIncomingMessage(MessageConnection messageconnection)
{

System.out.println("Income Message received: ");
}

public void notifyOutgoingMessage(Message message)
{

System.out.println("------------------------\n\n\n\n\n");
System.out.println("Message send: " + message);
}
}

 

Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: How to block sending SMS from BlackBerry in code

I'm not aware of any way to stop an SMS from being sent.

r4j
New Contributor
Posts: 3
Registered: ‎06-10-2012
My Device: 9530T

Re: How to block sending SMS from BlackBerry in code

Thanks, but is there anyway to get the process of application that send the message (process name, id) because I want to handle all application that send sms?

Developer
Posts: 95
Registered: ‎01-25-2010
My Device: 9530

Re: How to block sending SMS from BlackBerry in code

[ Edited ]

Implement SMS.addSendListener() and return false in sendMessage method. BTW, the SMS class was implemented on 4.6.0, so it's not possible to do this on earlier OS.