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
Highlighted
New Developer
Posts: 28
Registered: ‎07-17-2008
My Device: Not Specified
Accepted Solution

Deleting Intercepted SMS?

I have implemented MessageListener interface to intercept incoming SMS.

I am successfully able to intercept incoming message however I want to delete the SMS(should not show up at SMS Inbox). Can somebody suggest me the way to do it..? Here is my code snippet to intercept the message

 

public class SMSListener implements MessageListener { private int port; private MessageConnection messageConnection; // constructor public SMSListener(WebServiceScheduler webServiceScheduler, int port) { try { this.messageConnection = (MessageConnection) Connector.open("sms://:" + port); this.messageConnection.setMessageListener(this); } catch (Exception e) { Logger.getInstance().logInfo(Constants.SMS_LOG_FILE,"SMSListener:Error creating connection to default SMS Port::" + e.getMessage()); } } // This method is invoked when a message is received public void notifyIncomingMessage(MessageConnection messageConnection) { Logger.getInstance().logInfo(Constants.SMS_LOG_FILE,"notifyIncomingMessage:SMS received"); new Thread() { MessageConnection conn; Thread set(MessageConnection conn) { this.conn = conn; return (this); } public void run() { try { Message m = conn.receive(); String msg = null; if ( m instanceof TextMessage) { TextMessage tm = (TextMessage) m; msg = tm.getPayloadText(); } Logger.getInstance().logInfo(Constants.SMS_LOG_FILE,"notifyIncomingMessage:Message::" + msg); if(parseMessage(msg)) { // Do Something and then Delete it } } catch (Exception e) { Logger.getInstance().logInfo(Constants.SMS_LOG_FILE,"notifyIncomingMessage:Error receiving SMS::" + e.getMessage()); } } }.set(messageConnection).start(); }

 

 

Thanks in Advance.

Developer
Posts: 120
Registered: ‎07-16-2008
My Device: 9000

Re: Deleting Intercepted SMS?

The short answer is you cannot delete an SMS from the inbox.  You can send an SMS message that bypasses the inbox by sending the message on a non-default port.  Support for this varies by carrier and SMS provider.  You can find more information on this in the knowledge base article: How To use SMS to notify an Application
Kurt Zettel | Chief Architect | Metova
www.metova.com
New Developer
Posts: 28
Registered: ‎07-17-2008
My Device: Not Specified

Re: Deleting Intercepted SMS?

Thanks for the info.

 

Ok so If I want to test the Application on my BB and am sending an SMS from other mobile,since my SMS Provider is yet not ready. How can I change port/make it a system message?

 

Thanks

New Developer
Posts: 28
Registered: ‎07-17-2008
My Device: Not Specified

Re: Deleting Intercepted SMS?

Also we are using Third Party Solution to send an SMS and they allow us to only send Text of SMS and the Number, we do not have liberty to modify The Protocol Identifier and the Digital Coding Scheme.
Developer
Posts: 205
Registered: ‎07-14-2008
My Device: 7230, 8700, 8820, 9000

Re: Deleting Intercepted SMS?

Sounds like you should switch Third Party Solution.  :-)

 

I found that a good work around to not using the port number is to add a nice prefix to your text message.  For example:

 

"<nameofapp> system update"

 

Obviously this reduces the size of your message payload, but at least the user knows what it is when they see it in their inbox.

 

Earl 

Earl Oliver
Developer
Posts: 26
Registered: ‎07-23-2008
My Device: Not Specified

Re: Deleting Intercepted SMS?

I'm guessing that Verizon is one of the carriers that doesn't support port-directed SMSs? Also, I've noticed that cross-carrier SMSs tend to strip out the port information.

 

Thanks!

New Developer
Posts: 9
Registered: ‎07-16-2008
My Device: Not Specified

Re: Deleting Intercepted SMS?

Indeed it is our understanding that you cannot send port targeted SMS to Verizon devices. We have tried all known avenues and have not had any luck.

 

We offer SMS service over HTTP for many of our customers for this purpose, essentially we buy in bulk and resell cheaper/smaller packages.  We essentially make it easy to do (including auto carrier lookup and caching) without having to buy a large SMS package or understand anything about UDH. When you ask many of the SMSC's out there if they allow port targeting, many ironically either do not offer it or don't have any knowledge of it.  Even with the ones that are knowledgable about the subject, it can take some trial and error to get it right.

 

Unfortunately, we are still stuck with the service as-is on Verizon. It is worth noting that we were told that some CDMA providers support SMS UDH messages (usually only supported by GSM carriers).  One such carrier is rumored to be Virgin US, but we have not verified that to be fact just yet.

 

If you need service for port targeted/hidden BlackBerry system SMS messages, please feel free to contact us and we'll share anything we know to help or set you up with service from us.  

 

Best of luck.

Kevin Ross | President | Metova
www.metova.com
Developer
Posts: 24
Registered: ‎09-04-2008
My Device: Not Specified

Re: Deleting Intercepted SMS?

Hi! I want to get the SMS when the new SMS is coming in, and i want to store the message in database or Persistence store. Please give me the instructions. I am not very familiar in mobile and I am newbie. Please help me. I am still not understanding the port number for SMS. Please can you explain me more about SMS port for receiving.
New Developer
Posts: 5
Registered: ‎06-10-2009
My Device: Storm 9530

Re: Deleting Intercepted SMS?

Any ideas as to why BlackBerry will not allow us access to the SMS msg stores?.?

 

G

 

Ref:  http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&message.id=41805&jump=true#M... 

New Developer
Posts: 13
Registered: ‎12-26-2009
My Device: 8120
My Carrier: tmobile

Re: Deleting Intercepted SMS?

How do you format a system sms when it originates on another BB though?