Working with Pushover.NET

Overview

Pushover.NET is a Microsoft .NET based (C#) project that you can use if you would like to send mobile device alerts to Apple and Android mobile users who have the Pushover app installed. Pushover enables you to add mobile alert capabilities to your applications, increasing their usefulness and flexibility.

Pushover.NET can be used as-is with your projects, and you can start sending mobile alerts right away. We've designed Pushover.NET to be extremely flexible, whether you want to send simple alerts or you want to send alerts with custom subjects, priorities, sounds and more. It's designed to get you up and running quickly, without needing to know the details of the Pushover public API.

Prerequisites

Before you can send Pushover notifications, you need to purchase Pushover from the App Store or Google Play. You also need to visit http://www.pushover.net and register for your free account. By setting up your free account, Pushover will generate a user key for you. Once you have your user key, you need to register one or more applications to generate application keys.

You next need to download the main Pushover.dll from this site. You now have everything you need to start sending Pushover notifications!

Using Pushover.NET in Your Projects

Pushover.NET is ready to use. The DLL offered on this site is strongly named, so you can install it in the GAC if you'd like, or place it in the installation directory of your executable package--if you plan to redistribute your application.

Wherever you put the Pushover.dll file is up to you. Once you have it on your PC, launch Visual Studio and create a new project (or edit an existing one). Add a reference to Pushover.dll in your project, as well as a using DojoNorthSoftware.Pushover; statement anywhere you want to use Pushover.NET.

To send a Pushover notification, you simply call the static method Pushover.SendNotification.

Because Pushover's public API is designed to return error information, we capture errors in an Exception object. This Exception object is used as an output parameter to all overload methods. All overloads are bool methods, and return true if the notification was successfully sent and false if it failed. If false is returned, the Exception object will be populated with the details.

To send a simple Pushover notification, this code snippet will get you started:

public static void Main()
{
     Exception except;
     bool notify = Pushover.SendNotification("YOUR_APP_KEY_HERE", "YOUR_USER_KEY_HERE", "This is my first Pushover notification using Microsoft Visual Studio!", out except);
}


Pushover requires three parameters as a bare minimum -- your application key, your user key and a message. Optional parameters include a message subject, sound and priority. If you have multiple devices linked to your account and want to send your notification to just one device, you may also specify that device by name.

Last edited Aug 8, 2013 at 2:42 AM by msawyer91, version 3

Comments

No comments yet.