Deleting SMS interception?

I've implemented MessageListener interface in order to intercept incoming SMS.

I am successfully able to intercept the incoming message, but I want to delete the SMS (should not appear in the Inbox of SMS). Can anyone suggest me the way to do it... ? Here is my code snippet in order 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.

The short answer is that you can not delete a SMS in the Inbox.  You can send an SMS message that bypasses the Inbox by sending the message on a port not defined by default.  Support for this varies depending on the carrier and the SMS provider.  You can find more information in the knowledge base article: How to use SMS to alert an Application

Tags: BlackBerry Developers

Similar Questions

  • How to recover deleted SMS messages from this person? Having Iphone6

    How to recover deleted SMS from a specific person? Having Iphone6

    Welcome to the Apple community.

    You need to restore the phone from the point a to the top before you've deleted the message.

  • BlackBerry smartphone retrieve deleted SMS (very important!)

    I use BlackBerry 8320. I need to retrieve a deleted SMS. Will you help? Very important!

    The only way is to make regular backups and no do not remove anything between the two, so if you don't need all that was deleted just re - install the latest backup, I learned my lesson even as you the hard.

  • BlackBerry Passport delete sms forever

    How can I remove a sms forever?

    Because when I press DELETE and when someone else writes to me once again, I still see a story.

    Open the conversation. Press the three points at the bottom right. Select clear Chat.

  • Problems with SMS interception using notifyIncomingMessage on some BB

    Hello

    I use following code to detect incoming SMS and inform the user about a device external hw.

    //...
    import javax.wireless.messaging.*;
    import javax.wireless.messaging.MessageListener;
    import javax.wireless.messaging.MessageConnection;
    //...
    
    MessageConnection _mc = null;
    
    public class XXX extends MIDlet implements MessageListener ... {
      //...
      _mc = (MessageConnection)Connector.open("sms://:0");
      _mc.setMessageListener(this);
      //...
    }
    
    public void notifyIncomingMessage(MessageConnection conn) {
      //Message m = _mc.receive(); // 'conn == _mc', right?
      Message m = conn.receive();
      String address = m.getAddress();
      String msg = null;
    
      if ( m instanceof TextMessage )
      {
        TextMessage tm = (TextMessage)m;
        msg = tm.getPayloadText();
      }
      else if (m instanceof BinaryMessage) {
        StringBuffer buf = new StringBuffer();
        byte[] data = ((BinaryMessage) m).getPayloadData();
        msg = new String(data, "UTF-8");
      }
      //...
    
      System.out.println("Received SMS text from " + address + " : " + msg);
    }
    

    Basically, it's the code for the example of knowledge (http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/What_Is...). This example works well on 5 different real devices (4.5 to 5.0) I tested it on.

    However, some users report that SMS notifications does not work on their BB:

    8120 (4.5.0.124)

    8900

    9700 (5.0.0.405)

    I have it has not tested on any of these BB. All other notifications (e-mail, call, calendar...) work very well for them.

    No idea what could be the problem? (Before, I turn to the different interception method.)

    First potential problem is permissions Application - if accesds 'Phone' is not allowed, your attempt to register the MessageConneciton fails with a ControlledAccessException.

    Second potential problem is the fact that MessageListener can be opened only by a single application.  Subsequent attempts will fail with an exception (don't remember exactly what the exception is, something like the use of PortAlreadyIn).

  • Delete SMS txt

    Hi all. I read a lot of posts around that. I'm not the master in that, but without putting in place some settings on the server side as it says in:

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/796557/800451/800563/...

    Firstly I can visit on this server, second I want to remove these sms messages on my personal blackberry not manually but programming in JDE an app.

    The main reason the app that I want to write, it is to remove sms txt income which contains some special body or the code.

    Scenario: message sms arrive, I take him necessary info and after I want to remove it.

    Someone said in a post that we should move far when comes the sms txt, but how...?

    Maybe it's a way to remove their device physics but not manually. Like to find the message in the SMS Inbox and delete (but how? what classes, packages should I use for this?)

    Please help me with this, with a few tips, useful links.

    Thank you in advance.

    BlackBerry Enterprise Server doesn't send SMS messages.  There is no configuration is not required for the application of Pocket side listening for SMS messages.  The configuration of the system message is defined by the application server SMS sending-side.

  • BlackBerry smartphones, I can't delete SMS text messages

    I have 3 left strange SMS text messages in my "BOLD" I've tried the following 3 ways but still not able to remove:

    1. use manual Normal then remove

    2. use before Delete by Date

    3. use Desktop SW to erase the Messages database on the device.

    Can someone advise?   Thank you.

    Rgds

    C J

    have you tried to remove the battery from the unit and try again?

  • How can blackBerry smartphones, I recover the deleted SMS conversations?

    I accidentally deleted conversations SMS I need as evidence. Is it possible to get it back? I would like that there is a trash can for this phone. Help, please. Much of the solution. Thank you!

    Hi algie3115,

    Welcome to the BlackBerry support community forums.

    You back up your device data periodically? Because once a data are deleted from the device you cannot return t.

  • BlackBerry 8830 Smartphones deleting SMS messages

    Why is my 8830 erasing my SMS messages before they are read.  And if I send a message, it will be also possible to erase my message after 30 seconds.  What should I do?

    You need to free memory.  Your BB memory is full:

    http://www.BlackBerryForums.com/General-BlackBerry-discussion/112029-optimize-your-BB-Setup-Max-memo...

  • BlackBerry Smartphones delete SMS

    Is it possible to delete a text on a Torch 9800 message without opening it?

    Scroll up to it > touch menu > delete

    or scroll up to it > press your delete key if the keyboard is slid open

  • BlackBerry smartphones delete SMS Messages

    Hello

    I have a BlackBerry "BOLD" and two sms messages I do not succeed to remove by standard procedure. One of the two has a tick with a D on top. The other standard envelope.

    Thanks for your suggestions

    Andreas

    The message with the envelope is a message for you. The one with the tick mark is the answer or the message that was sent by you. D just means that the message has been delivered.

  • BlackBerry Smartphones SIM card is full please delete some SMS

    I've been using BB for 4 years and in February, I bought BB9900. Since last week, I am facing some problems.

    1. whenever I get a message I get the message that the SIM card is remove full please some SMS

    2. my service provider is vodafone and EDGE is not posting I checked with them and they changed the SIM, but still it does not work.

    I would like to get some tips on the same.

    Concerning

    Rambeau

    1 ""SIM card is full please delete SMS messages "appears on the smart phone BlackBerry "

    2 otherwise EDGE, what is displayed?

  • Automatically deleting blackBerry Smartphones my SMS text!

    I bought my Blackberry at a friend's House and there seems to be a few things wrong with it!

    I don't touch even my phone and my SMS will remove themselves...

    I receive an SMS and it will automatically delete until I read it...

    There is therefore the possibility of composing and MMS message on my device...

    HELP PLEASE!

    Hello and welcome to the Forums of Support BlackBerry.com.

    For the MMS, which carrier do you have? Some carriers, such as Sprint are not MMS.

    For auto-delete SMS text messages:

    First thing? Check the file without Options > status, what is the number to the free file? Now, remove the battery from your device, hold a minute, replace, and restart. What is now the free file?

    Read this: http://www.blackberryforums.com/general-blackberry-discussion/116396-managing-your-bb-memory-lost-ca...

    And this: http://www.blackberryforums.com/general-blackberry-discussion/112029-losing-call-logs-sms-emails-opt...

    Other links to read:
    http://www.BlackBerry.com/BTSC/search.do?cmd=displayKC&docType=kc&externalId=KB15345&sliceId=SAL_Pub...
    http://www.BlackBerry.com/BTSC/search.do?cmd=displayKC&docType=kc&externalId=KB14320&sliceId=SAL_Pub...
    http://www.BlackBerry.com/BTSC/dynamickc.do?externalId=KB14213&sliceId=SAL_Public&command=show&forwa...

  • BlackBerry Smartphones SMS full Notification - help please

    I'm at my wits end with my Blackberry Torch 9810.  I have very little text messages in my Inbox, I lost the lot for some reason my phone has decided to change some date & in the future and trying to resolve that, in my opinion, I wiped everything, do not know what I did a few weeks ago, but they disappeared.

    Now I get notifications that my SMS Inbox is full and I need to delete messages.  Can someone help me I have a lot of messages on the handset and cannot believe it is complete unless there is an option I need to select/deselect.  The user guide is useless.

    I changed a parameter in the past as text messages seem to be endangered if they were in a month or so old, but all that I did I can't and don't know how to handle all my text messages myself.  My old iphone allowed me to keep the text as long messages I wanted with what appeared to be a very large storage area, now I just want to throw this thing in the bin.  Unfortunately I have 18 months remaining on my contract (business) so I can do nothing about it.

    Ann3da wrote:

    50 SMS Messages / 29.5 K

    15 text messages / 12.3 K

    OK, not a lot of people very little. It is in memory of the device, but you are some of the SIM card, save too much.

    Then... you must change this setting according to the instructions below.

    Article ID: KB13465 "SIM card is full please delete SMS messages" appears on the BlackBerry smartphone

  • BlackBerry Smartphones emails deleted on device does not delete the account Onlin

    I upgraded my BlackBerry software last night.  When I try to delete e-mails from my e-mail account, the only options I have are 'Delete' or 'Cancel' (as when I delete SMS/MMS messages). They delete my BB and not my real email (Hotmail) address.  My other email accounts work correctly - I have the option of deleting on the handheld or deletion of mailbox & Organizer boxes.  My other mails are Hotmail and Yahoo.  I get tons of emails per day that I need to remove and I really want to have to delete them from my BB and then have to access my Hotmail and re-delete-the online account.  Can anyone help?

    You can check the following setting. Go into Messages. Options | Reconciliation of the e-mail. If you change your Hotmail account, what is your delete value? You should have 3 choices to choose from:

    • Handheld means that he will remain in the mail client once removed from the device
    • Mailbox and Pocket PC means it will remove both the e-mail client and the device
    • Prompt means that the person would get a prompt on the BlackBerry, either remove it from your handheld or the mailbox, and the Organizer

Maybe you are looking for