Monday, 11 June 2012

Windows 8 Metro MVVM Light Push Notification Fix

I'm working on a WP7 port to Windows 8 and got to the push notifications section. I'd been struggling to get notifications to work. Mike Taulty kindly helped me out with this: to test notifications without Azure. My MVVM Light app wouldn't respond and I was getting 403 - Forbidden responses from the WNS server. I suspected there may be something wrong with my app so I built a bog standard "Hello Windows 8" app which worked nicely, so it proved that there was something wrong with my app!

I figures it would be something wrong with an ID or something similar because I know in WP7 MVVM Light projects the app GUID in the manifest is always the same which causes apps to be overwritten on deployment. There is no ID in the manifest so I had a look at the pfx file and it's got Laurent's id on it. So this is what I did:

1. Copied the pfx from "Hello Windows 8" app to my MVVM Light app and renamed it.

2. Edited the MVVMLightProject.csproj and changed the name and thumbprint of the pfx to that of "Hello Windows 8"


3. Launched my app and grabbed the channel URI from the output window (noticed it was slightly longer than before) and put it into Mike's app along with the other API info and....

4. It worked!