V
VicToro
Hi,
I am having problems to use the MessageInterceptor class on a
background app. It worked when I used a device app with a form. But
now, I try to use it in a console app because I want to run it as a
background process.
I have a main class, that is a Console App, that creates a SMSListener
class.
Then the main class calls the start method of the SMSListener:
public void Start()
{
MessageCondition msgCond = new
MessageCondition(MessageProperty.Sender, phoneNumber);
msi = new
MessageInterceptor(InterceptionAction.NotifyAndDelete,false);
msi.MessageCondition = msgCond ;
msi.MessageReceived += new
MessageInterceptorEventHandler(msi_MessageReceived);
}
Suppously when a message if intercepted it executes:
void msi_MessageReceived(object sender,
MessageInterceptorEventArgs e)
{
SmsMessage smsMessage = (SmsMessage)e.Message;
if (smsMessage.Body.StartsWith(keyWord))
{
// process message, show a message Box or any other
action
}
}
If I use a Device App with a Form there is no problem. It intercepts
the message coming from the number "phoneNumber" and process them if
they start with the keyword.
But I am using a Console App in the device, as background process, and
when a message is received from the number "phoneNumber" it displays
as normal message for the phone, and it goes to the Inbox.
Anyone can give a clue?
Cheers,
Victor
I am having problems to use the MessageInterceptor class on a
background app. It worked when I used a device app with a form. But
now, I try to use it in a console app because I want to run it as a
background process.
I have a main class, that is a Console App, that creates a SMSListener
class.
Then the main class calls the start method of the SMSListener:
public void Start()
{
MessageCondition msgCond = new
MessageCondition(MessageProperty.Sender, phoneNumber);
msi = new
MessageInterceptor(InterceptionAction.NotifyAndDelete,false);
msi.MessageCondition = msgCond ;
msi.MessageReceived += new
MessageInterceptorEventHandler(msi_MessageReceived);
}
Suppously when a message if intercepted it executes:
void msi_MessageReceived(object sender,
MessageInterceptorEventArgs e)
{
SmsMessage smsMessage = (SmsMessage)e.Message;
if (smsMessage.Body.StartsWith(keyWord))
{
// process message, show a message Box or any other
action
}
}
If I use a Device App with a Form there is no problem. It intercepts
the message coming from the number "phoneNumber" and process them if
they start with the keyword.
But I am using a Console App in the device, as background process, and
when a message is received from the number "phoneNumber" it displays
as normal message for the phone, and it goes to the Inbox.
Anyone can give a clue?
Cheers,
Victor