Windows Phone SDK Configuration Guide

In order to integrate Pushwoosh into your application, follow the steps below.

1. Download our SDK package. If you develop for Windows Phone 8, you need to use PushSDK.WP8.csproj. For Windows Phone 7 please use PushSDK.WP7.csproj.

2. Open the App.xaml file

3. Add the PushSDK namespace:

<Application
              ...
             xmlns:PushSDK="clr-namespace:PushSDK;assembly=PushSDK"
             ...

4. Replace this part

 <shell:PhoneApplicationService Activated="Application_Activated"
                                       Closing="Application_Closing"
                                       Deactivated="Application_Deactivated"
                                       Launching="Application_Launching" />

with the following:

 <PushSDK:PhonePushApplicationService Activated="Application_Activated"
                                             Closing="Application_Closing"
                                             Deactivated="Application_Deactivated"
                                             Launching="Application_Launching">
            <!--  PushWoosh application ID  -->
            <PushSDK:PhonePushApplicationService.PWAppId>{PushWoosh application ID}</PushSDK:PhonePushApplicationService.PWAppId>

            <!--  Page on which the navigation is when receiving toast push notification. Note: Full path.  -->
            <PushSDK:PhonePushApplicationService.PushPage>{Full path to page}</PushSDK:PhonePushApplicationService.PushPage>

            <!--  Page on which the navigation is when receiving toast push notification.  -->
             <PushSDK:PhonePushApplicationService.ServiceName>{ServiceName}</PushSDK:PhonePushApplicationService.ServiceName>  

            <!--  Tile trusted servers  -->
            <PushSDK:PhonePushApplicationService.TileTrustedServers>
                <System:String>http://www.pushwoosh.com</System:String>
            </PushSDK:PhonePushApplicationService.TileTrustedServers>

        </PushSDK:PhonePushApplicationService>
    </Application.ApplicationLifetimeObjects>

5. Set up the connection settings

  • PWAppId – unique identifier of your application in Pushwoosh (required);
  • PushPage – the page that handles incoming Toast (required for Toast notifications);
  • ServiceName – the name of the service that sets up an SSL channel to Pushwoosh (required for secure connections);
  • TileTrustedServers – a list of the trusted servers that could send Tile notifications (required for receiving Tile notifications).

6. Set up the Toast notifications subscription, if necessary:

  • Open the page constructor;
  • Get the NotificationService instance:

  • 
    NotificationService _service = ((PhonePushApplicationService)PhoneApplicationService.Current).NotificationService;
    
  • Sign up for OnPushAccepted event. It returns the notification content string:

  • 
    _service.OnPushAccepted += (sender, args) => {Do something…};
    

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

SDK comes with the full source and a Sample Project. You can use an emulator while working with push notifications.


Advanced features

Tags

Tags allow you to create a set of devices based on different criteria.

1. Create a list of tags:


var tagsList = new List<KeyValuePair<string, object>>();

2. Add a tag to the list:


tagsList.Add(new KeyValuePair<string, object>("testKey", "testValue"));

3. Get the instance of NotificationService:


NotificationService _service = ((PhonePushApplicationService)PhoneApplicationService.Current).NotificationService;

4. The OnSendingComplete event is called in case of successful tags delivery and returns a list of ignored tags. The list contains tags and the reason these tags were disregarded.


_service.Tags.OnSendingComplete += (sender, args) => {Do something…};

5. Send tags to Pushwoosh


_service.Tags.OnSendingComplete += (sender, args) => {Do something…};

User Data

The application user can send any custom data to Pushwoosh with the custom tag.

1. Get the instance of NotificationService:


NotificationService _service = ((PhonePushApplicationService)PhoneApplicationService.Current).NotificationService;

2. Receive user custom data:


string userData = _service.UserData;

Geo zones

You can send push notifications to users located in a specific area.

1. Turning Geo Zones on:

  • Get the instance of NotificationService:

  • 
    NotificationService _service = ((PhonePushApplicationService)PhoneApplicationService.Current).NotificationService;
    
  • Turn on the geo service:

  • 
    _service.GeoZone.Start();
    

2. Turning Geo Zones off

  • Get the instance of NotificationService:

  • 
    NotificationService _service = ((PhonePushApplicationService)PhoneApplicationService.Current).NotificationService;
    
  • Turn off the geo service:

  • 
    _service.GeoZone.Stop();