sudorossy
sudorossy

Reputation: 85

Sending Push Notification to Windows 8 Metro style app in C#

I've downloaded the Microsoft sample code for registering your app to push notifications to. Sample

I have sent the channel URI to myself in an email, and I believe I have all the relevant information to actually send a push. But I've never dealt with the server-side sending of a push notification.

The sample app should just output whatever I send.

I can't find any pre-existing apps to help me. I just want to be able to see some information in the sample app window. From there I should be able to figure out what to send in future, headers, etc.

Is there a sample app, where I just put in the Channel Uri, token, SID and secret, and it'll send something like "Hello world" to my app? Preferably with source, so I can take it apart and see how it's being done.

Upvotes: 2

Views: 3106

Answers (2)

Jim O'Neil
Jim O'Neil

Reputation: 23754

I will second the recommendation for Windows Azure Push Notifications, with another blog overview (using JavaScript) here

If you do want to get under the hood a bit more the reference pointed to above - http://watwindows8.codeplex.com/ - does work with RTM; however, the setup is coded to work only with the Release Preview.

If you'd like to set it up you can do the following:

  1. In Setup\CheckW8.ps1 change the build number in text from 8400 to 9200

    $os = Get-WmiObject Win32_OperatingSystem; if ($os.BuildNumber.Equals("9200")) { exit 1; } ...

  2. Then in Setup\DependencyChecker\WATWindows8.depi, delete the three <dependency> sections entirely. The assumption here is that you already have Visual Studio 2012 RTM, the Azure Tools for 2012 RTM, and NuGet is up to date.

When you run the setup as instructed by the Toolkit, it should now work. You'll get an empty list of dependencies, but that's fine since you've already installed them manually.

The C# Push Notification sample code should be fine on a recompile (you'll get an error about the package name, but that's expected since it's part of the configuration you need to do).

For the JavaScript version, you'll have to patch the script references to the RC version in default.html, remove the old "Window Library for JavaScript" from the references and add the new one.

Upvotes: 0

Michael S. Scherotter
Michael S. Scherotter

Reputation: 10785

Take a look at the tutorial for the Windows Azure Mobile Services Push Notification: http://www.windowsazure.com/en-us/develop/mobile/tutorials/get-started-with-push-dotnet/

Upvotes: 3

Related Questions