开发者

Xml Problem Sending Toast Notification to Running WP7 Application

Folks, I've got my sample application for WP7 running. I've also got a service (WCF) and I've got a push notification sender (WPF). So far this looks pretty similar to the push notification arrangement that Microsoft has set up in the WP7 training kit. When I launch the app and then exit the app to go back to the home screen, I am able to successfully send a toast notification - it appears on the top, makes a little noise, displays the right text, and launches my app when you tap it.

However, when I send the same exact shell toast notification to my application while the application is running in the foreground, I get an error complaining that there is an invalid character for the root XML node. This error occurs deep within the bowels of WP7 as my toast notification handler is never called and the debugger can't show me the line of code that generated the error.

I am using the NotificationSenderUtility that comes with the WP7 push notification开发者_StackOverflow sample in the training kit to send the notifications.

If anybody knows why this is happening or how I can fix it, I would love to know because I've got a demo I'm giving at a code camp on Saturday and push notifications are supposed to be part of the demo :)

Here's the stack trace I get:

at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.Throw(Int32 res, String resString, String[] args) at System.Xml.XmlTextReaderImpl.Throw(Int32 res, String resString) at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace() at System.Xml.XmlTextReaderImpl.ParseDocumentContent() at System.Xml.XmlTextReaderImpl.Read() at Microsoft.Phone.Notification.ShellObjectChannelInternals.ParseXMLToProperties(String xmlString, IDictionary`2& propertyBag) at Microsoft.Phone.Notification.ShellObjectChannelInternals.OnNotificationReceived(IntPtr blob, UInt32 blobSize) at Microsoft.Phone.Notification.ShellObjectChannelInternals.ChannelHandler(UInt32 eventType, IntPtr blob1, UInt32 blobSize1, IntPtr blob2, UInt32 blobSize2) at Microsoft.Phone.Notification.HttpNotificationChannel.Dispatch(Object threadContext) at System.Threading.ThreadPool.WorkItem.doWork(Object o) at System.Threading.Timer.ring()


Thanks, Kevin


Check your code on client and sender complies with the latest documentation. There was a change to the spec during beta.

How to: Send a Push Notification from a Web Service for Windows Phone

How to: Set Up a Notification Channel for Windows Phone

It's possible the tools/code you're using from the training kit hasn't been brought up to spec with that yet.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜