Windows SDK Integration

How to integrate Pushwoosh SDK into your Windows project

Download SDK Download Sample SDK API Docs

Supports Windows 8.1 and Windows 10

SDK Integration

You can use an emulator while working with push notifications.

To integrate Pushwoosh into your application, follow the steps below.

1. Download our SDK package.

2. Add reference to PushSDK/Project-Win8.1-WNS/PushSDK.winmd to your project Or PushSDK/Project-Win10-WNS/PushSDK.winmd if you develop for Windows 10

3. In the code add PushSDK namespace: using PushSDK;

4. Initialize push service with the following code:

NotificationService service = PushSDK.NotificationService.GetCurrent("YOUR_PUSHWOOSH_APP_ID");
service.OnPushAccepted += (sender, pushNotification) => {
    //code to handle push notification
    string pushString = pushNotification.ToString(); //will return json push payload
};
 
service.OnPushTokenReceived += (sender, pushToken) => {
    //code to handle push token
};
 
service.OnPushTokenFailed += (sender, errorMessage) => {
    //code to handle push subscription failure
};
 
service.SubscribeToPushService();

5. In your App.xaml.cs in OnLaunched function add:

protected override void OnLaunched(LaunchActivatedEventArgs args)
{
    NotificationService.HandleStartPush(args.Arguments);
 
    //other code
}

Important!

If you plan to use Toast notifications, make sure Toast notifications are switched on in your application project. Go to the Application UI tab in manifest settings, and set Toast Capable to Yes. Otherwise, Toast notifications will not work on the device.

Known issues for Windows 8.1

When integrating the Pushwoosh SDK into your Windows 8.1, you might face the following error:

The underlying connection was closed: An unexpected error occurred on a send

If you encounter that error, add the following code to your project:

// Default is 'false'
NotificationService.IsWin81(true);

Last updated