»  WINDOWS 8 »  Windows 8 Javascript SDK

Windows 8 Javascript SDK

Windows 8 javascript sdk has never been so easy! Our extensive guides for all platforms currently available on the market show how to integrate push notifications within several minutes and with several lines of code. You can choose between native programming tools and a diverse set of cross-platform solutions. We are working hard on extending the list of supported SDKs, plugins and modules, so we advise coming back once in a while to see what's new. If you believe that some great tools should be added here, please let us know, and we will do our best to get them up and running!

SDK Integration

You can use an emulator while working with push notifications.

In order to integrate BulkPush into your Windows 8 JS application, follow the steps below.

1. Download our SDK package.

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

3. Initialize push service with the following code:

 

var service = 
new BulkPushSDK.NotificationService.getCurrent(id, "", null);
        service.setHost(host);
 
        service.ononpushaccepted = function (args) {
            var md = 
new Windows.UI.Popups.MessageDialog(args.toString());
            md.showAsync()
        }
service.subscribeToPushService();
 
    var fieldNameElement = document.getElementById('userToken');
    if (fieldNameElement.firstChild && service.pushToken != null) {
    fieldNameElement.firstChild.nodeValue = service.pushToken;
        }
 
    service.ononpushtokenreceived = function (pushToken) {
      var fieldNameElement = 
             document.getElementById('userToken');
      if (fieldNameElement.firstChild) {
            fieldNameElement.firstChild.nodeValue = pushToken;
            }
        }
 
     service.ononpushtokenfailed = function (error) {
      var fieldNameElement =  
      document.getElementById('userToken');
      if (fieldNameElement.firstChild) {
         fieldNameElement.firstChild.nodeValue = error;
            }
        }

 

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
 BulkPushSDK.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. 

 

Windows 8 push notification Service

 

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 BulkPush:

 

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();

 

 

© 2015 BulkPush.com By Broadnet Technologies Ltd.