Windows 8 Javascript SDK

**Download SDK **W8 JS Sample

SDK Integration

You can use an emulator while working with push notifications.
In order to integrate Pushwoosh into your Windows 8 JS application, follow the steps below.

1. Download our SDK package.

2. Add reference to PushSDK/SDKBuild/PushSDK.winmd to your project

3. Initialize push service with the following code:

var service = new PushSDK.NotificationService.getCurrent("YOUR_PUSHWOOSH_APP_ID"); service.ononpushaccepted = function (args) { //code to handle push notification //display push notification payload for test only var md = new Windows.UI.Popups.MessageDialog(args.toString()); md.showAsync() } service.ononpushtokenreceived = function (pushToken) { //code to handle push token } service.ononpushtokenfailed = function (error) { //code to handle push subscription failure } service.subscribeToPushService();
**4.** In your **app.onactivated** function add the following:
app.onactivated = function (args) { if (args.detail.kind === activation.ActivationKind.launch) { if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) { // TODO: This application has been newly launched. Initialize // your application here. //Handle start push PushSDK.NotificationService.handleStartPush(args.detail.arguments);
**Important!** If you plan to use Toast notifications, please make sure you have switched Toast notifications on in your application project. Go to the Application UI tab of your application manifest settings, and set **Toast Capable** to **Yes**. Otherwise Toast notifications will not work on the device.

Application UI tab

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

Advanced features

Tags

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

  1. Create a list of tags:
var keys = ["name1", "name2"]; var values = ["value1", "value2"];
2. Send tags to Pushwoosh:
service.sendTag(keys, values);
### Geozones

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

  1. Turning Geo Zones on:
service.startGeoLocation();
2. Turning Geo Zones off:
service.stopGeoLocation();