Search code examples
c#smswindows-mobileinboxwindows-mobile-5.0

How receive SMS in windows mobile application and put it into the Inbox


I am doing sample application using windows mobile 5.0. When I receive an SMS, I want to check for certain criteria (eg: "Honda"). If I find that word, I will do my process, if not, it must be stored in the Inbox.

I wrote the code receiving SMS and searching the criteria, but I don't know how to put the SMS in the Inbox.

Anybody got an idea for doing this just give me hint I will do on my own.


Solution

  • The first step in catching received SMS text messages is to create an instance of the MessageInterceptor class that lives in the Microsoft.WindowsMobile.PocketOutlook assembly. You need to be careful about where you define this instance as if it goes out of scope and is garbage collected the message interception will stop.

    MessageInterceptor interceptor =
      new MessageInterceptor(InterceptionAction.NotifyAndDelete);
    

    An InterceptionAction is passed to the constructor. This parameter defines the behavior that occurs when a message is received.

    The two options are:

    • Notify - The message interceptor gets a chance to process the message but it is also received by the standard SMS inbox application.
    • NotifyAndDelete - The message does not become visible to the user and is only seen by the message interceptor.