Windows Phone SDK

How to integrate Pushwoosh into your Windows Phone application

SDK Integration

Integration guide for Windows Phone 8.1 and upper versions

If you target Windows Phone version 8.1, please use this guide for the integration.

You can use an emulator while working with push notifications.

1. Download our SDK package. If you develop for Windows Phone 8, add reference to PushSDK/WP8-MPNS/Release/PushSDK.dll to your project.

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

3. Initialize push service with the following code:

NotificationService service = NotificationService.GetCurrent("YOUR_PUSHWOOSH_APP_ID",  "AUTH_SERVICE_NAME_OR_NULL", null);
service.OnPushTokenReceived += (sender, pushToken) => {
    //code to handle push token
};
 
service.OnPushTokenFailed += (sender, error) => {
    //code to handle push subscription failure
};
 
service.OnPushAccepted += (sender, pushNotification) => {
    //code to handle push notification
};
 
service.SubscribeToPushService();
  • First parameter – identifier of your application in Pushwoosh (required);
  • Second parameter – name of service for authenticated pushes: pass null if you don’t have one set-up;
  • Third parameter – list of the trusted servers that can send Tile notifications (required for receiving Tile notifications).

4. Make sure you have enabled ID_CAP_PUSH_NOTIFICATION and ID_CAP_IDENTITY_DEVICE in your project. Expand Properties folder in your Windows Phone application project and open WMAppManifiest.xml.

Enable ID_CAP_PUSH_NOTIFICATION and ID_CAP_IDENTITY_DEVICE capabilities by checking the corresponding checkbox.

<Capabilities>
      <Capability Name="ID_CAP_IDENTITY_DEVICE" />
      <Capability Name="ID_CAP_PUSH_NOTIFICATION" /> // Enable to allow push notifications for your application
      <Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />
</Capabilities>

That’s it! Easy, isn’t it?

Windows Phone SDK

How to integrate Pushwoosh into your Windows Phone application