Customizing SDK

Tags

With tags, you can create sets 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 an instance of NotificationService and send tags!

NotificationService service = NotificationService.GetCurrent();
service.SendTag(tagsList,
    (obj, status) =>
    {
        MessageBox.Show("Tag has been sent!");
    },
    (obj, error) => MessageBox.Show("Error while sending the tags: \n" + error.ToString())
);

User Data

The app users can send all kinds of custom data to Pushwoosh using the custom tag.

Get an instance of NotificationService and collect user data with push notifications (it also comes in the push notifications payload by the way!)

NotificationService service = NotificationService.GetCurrent();
string userData = service.UserData;

Geo zones

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

1. Expand Properties in your Windows Phone application project and open WMAppManifiest.xml.

Find checkbox and enable ID_CAP_LOCATION. Now, the application can use device location for the GeoZones feature.

<Capabilities>
      <Capability Name="ID_CAP_NETWORKING" />
      <Capability Name="ID_CAP_LOCATION" /> // Enable to use geolocation services
      <Capability Name="ID_CAP_PUSH_NOTIFICATION" />
      <Capability Name="ID_CAP_IDENTITY_DEVICE" />
      <Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />
</Capabilities>

2. Turning Geo Zones on:

NotificationService service = NotificationService.GetCurrent();
service.StartGeoLocation();

3. Turning Geo Zones off:

NotificationService service = NotificationService.GetCurrent();
service.StopGeoLocation();

In-Apps Tracking

When a user buys a product, call the following method:

service.TrackInAppPurchase(string productId, double price, string currency)
  • productId – product identification (also known as SKU)
  • price – product price
  • currency – price currency
    Example:
service.TrackInAppPurchase("com.example.inapp1", "1.99", "USD");

Customizing SDK