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
New Developer
Posts: 40
Registered: ‎12-04-2009
My Device: Storm 9530

How to block incoming SMS programatically in Blackberry 4.5 and later?

Hello All,

How to block incoming SMS programatically in Blackberry 4.5 and later? 

 

 

 

Thanks & Regards

Devang

Developer
Posts: 466
Registered: ‎04-11-2012
My Device: Bold 9900
My Carrier: Rogers

Re: How to block incoming SMS programatically in Blackberry 4.5 and later?

i dotn think it can be done or else crunchsms would have done it already instead of asking the users to do ti manually


Developer for easyDial for BlackBerry Bold & inLink for BlackBerry PlayBook
Find me online via twitter, or on the techfruits.com webpage. Please hit the like button below if what I said helped!
Highlighted
Developer
Posts: 179
Registered: ‎06-15-2011
My Device: Storm 9550
My Carrier: Vodaphone

Re: How to block incoming SMS programatically in Blackberry 4.5 and later?

public DatagramConnection _datagramConnection;
private Connection _connection;
_connection = (DatagramConnection) Connector.open("sms://:0");
_datagramConnection = (DatagramConnection) _connection;
DatagramBase datagramBase = (DatagramBase) _datagramConnection.newDatagram(_datagramConnection.getMaximumLength());
_datagramConnection.receive(datagramBase);
DatagramAddressBase datagramAddressBase = datagramBase.getAddressBase();
SmsAddress smsAddress = (SmsAddress) datagramAddressBase;
SMSPacketHeader smsPacaketHeader = smsAddress.getHeader();
String serviceCenter = smsPacaketHeader.getSCAddress();
smsPacaketHeader.setMessageWaitingType(SMSPacketHeader.WAITING_INDICATOR_TYPE_VOICEMAIL);

 if you change message waiting type to voicemail, it will be blocked.