Add Push Notification to SharePoint Apps

I’ve been working on an application to help me with some SharePoint 2010 API/web services/client OM performance testing—I’ve given this app the sufficiently geeky name ‘SharePoint Genesis Device.’ The operations that this application runs can take many hours, and I don’t want to have to keep checking if it has completed. For this reason, I’ve added Growl/Prowl support so that I can receive push notifications on my PCs and smart phone.

image

                                                 - A Prowl notification sent to my phone

I’ve just started on this project, but the screenshot below shows what the SharePoint Genesis Device looks like today. I’m going to use Prowl ($2.99) as my mobile app for Growl notifications, but there are other options out there. However, I found Prowl to be easy to set up, so I recommend it.

image

After adding Growl (PC notifications) and Prowl (iPhone notifications) support, I am able to send push notifications both to PCs and smart phones. If you would like to do the same, I suggest you focus on getting Growl working first. It’s a requirement for the Prowl setup, so don’t worry about Prowl until you have Growl notifications working.

Follow these steps to add Growl and Prowl support to your C# application:

1. Download the Growl for Windows client and install it.

2. Download the Growl SDK and read the Growl documentation for details on adding Growl code to your application. Here is the code I used:

using Growl.CoreLibrary;
using Growl.Connector;

DateTime stopTime = DateTime.Now;
wlConnector growl = new GrowlConnector();
Growl.Connector.Application application = new Growl.Connector.Application("SharePoint Genesis Device");
application.Icon = @"\GrowlNetLibraries\growl4windows.jpg";
NotificationType operationComplete = new NotificationType("COMPLETE", "Operation Complete");
growl.Register(application, new NotificationType[] { operationComplete });
Notification notification = new Notification("SharePoint Genesis Device", "COMPLETE", "ID", "Operation Complete", "End time: " + stopTime.TimeOfDay.ToString());
growl.Notify(notification);

After you execute this code, you should see your application registered in Growl and the updates should appear on your PC. To open Growl, right-click on it in the system tray and choose Open Growl.

image

                           - Updates from my SharePoint app in Growl

If you have Growl set up and working, then you can add Prowl to send notifications to your phone. If you only want PC notifications, then you’re done.

3. Register for Prowl.

4. Login to the Prowl website and get your Prowl API key. You will need to enter this key into the Growl client so that notifications can be forwarded to your Prowl device.

5. Open the Growl client on your PC and add Prowl as a computer for forwarded notifications. Use the API key from Prowl.

image

6. Install Prowl on your iPhone from the app store and enter your login credentials.

That’s all! You’ve now got push notifications on your PC and smart phone.