views:

595

answers:

3

I've written a small windows mobile application, which intercepts incoming SMS and does some processing on them.

After selling about 30 of these apps on windows marketplace I noticed a problem. The problem does (so far) only occur on one device:
the HTC HD2.

The problem is quite simple: I attach my program to a system service called MessageInterceptor like this:

private void RegisterInterceptor()
{
 _msgInterceptor = new MessageInterceptor(InterceptionAction.Notify, true);  
 _msgInterceptor.MessageReceived += new MessageInterceptorEventHandler (_msgInterceptor_MessageReceived);
 String appPath = Assembly.GetExecutingAssembly().GetName().CodeBase;
 _msgInterceptor.EnableApplicationLauncher(_appID, appPath, "Program started by System");
}

void _msgInterceptor_MessageReceived(object sender, MessageInterceptorEventArgs e)
{
 SmsMessage sm = e.Message as SmsMessage;
 if (sm != null)
  labelMsgReceived.Text = "SMS rcvd \"" + sm.Body + "\"";
 else
  labelMsgReceived.Text = "Unknown message rcvd";
}

This usually does work nicely. Just on these HTC HD2 this event never is called.

I do not own a HTC HD2, so I can't test the device myself. I heard rumors, that there do exist some HD2 where this does work as expected, but so far I got no confirmation about this.

I'm looking for a workaround.
Is there something on the HD2 which does disable this function?
Are there other ways to intercept SMS which I might use?

+1  A: 

Might be something to do with HTC Sense which effectively replaces large swathes of the standard UI, including the default SMS application - it may be the case that PocketOutlook, which normally fires the message interceptors isn't even being loaded.

I've tested using the example code form MSDN, and that doesn't appear to work on a HD2, which matches what you're seeing.

Rowland Shaw
Dang. HTC breaks the system functions and we app developers have to pay the price. !nice
Sam
A: 

certain phones have this or a similar registry key set to 1 changing to 0 will allow interceptor to work

HKEY_LOCAL_MACHINE\Software\Microsoft\Inbox\Svc\SMS\Rules:{1000BC1C-F4A3-4210-B197-4AEBF2CEE6F5}

set to 1 by default intercept doesn't work set to 0 and intercept works

Nathan
Actually the HTC support admitted that HTC Sense on the HD2 did break this functionality. The pretend to be working on a fix...
Sam
A: 

What I gather there are two different fixes for this.

  1. You build your own MapiRule.dll. This is a good post how to do it. http://minhdanh2002.blogspot.com/2010/07/intercept-incoming-sms-message-on-htc.html

  2. If the above rule fix, mentioned by Nathan, doesn't solve it. Which didn't on our HTC HD mini T5555 phone. You can use this reg hack. Which does the below reg changes:

HKLM\services\MSG and rename "MessagingService.dll" to any thing else. Then goto HKLM\system\inbox\externalaccounts and renama SMS to something else. After this you will have to restart, to get it running.