{"__v":6,"_id":"55af4470826d210d00041e15","category":{"__v":3,"_id":"5540e63031827a0d007ab215","pages":["55af3e8a826d210d00041e08","55af3ed3826d210d00041e0a","55af4470826d210d00041e15"],"project":"5540ce1b31827a0d007ab1cc","version":"5540ce1c31827a0d007ab1cf","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-04-29T14:09:52.700Z","from_sync":false,"order":10,"slug":"windows-8","title":"Windows 8"},"parentDoc":null,"project":"5540ce1b31827a0d007ab1cc","user":"55a79a4d4a33f92b00b7a111","version":{"__v":31,"_id":"5540ce1c31827a0d007ab1cf","project":"5540ce1b31827a0d007ab1cc","createdAt":"2015-04-29T12:27:08.390Z","releaseDate":"2015-04-29T12:27:08.390Z","categories":["5540ce1c31827a0d007ab1d0","5540d91bbb9e762d00f594ad","5540e5f131827a0d007ab212","5540e5febb9e762d00f594d3","5540e61331827a0d007ab213","5540e6195cf9682100d61afa","5540e62631827a0d007ab214","5540e63031827a0d007ab215","5540e63531827a0d007ab216","5540e63e5cf9682100d61afc","5540e6445cf9682100d61afd","5540e64a5cf9682100d61afe","55a4ff5b2e70c0250038050f","55acb28318eefd0d0071d504","55ae1abe8576b92300291c80","55ae453ef302af23000ac109","55af586d555b900d0036d296","55af91dac8a85321007a53c3","55b9fee204775a2f00628071","55b9ff0e04775a2f00628072","55b9ff4604775a2f00628073","55b9ff5fd72d1e1900276a38","55b9ff7f04775a2f00628074","55b9ff90eb08801900f833e5","55b9ffa5d72d1e1900276a39","55b9ffca04775a2f00628075","55b9fffdd72d1e1900276a3a","56bc2f033ee9e70d008b46af","56c2f6efbbf9ec2d00e0fe4f","57595bbb18760817001e8bbe","57d8d9793916800e003dde53"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-07-22T07:21:20.060Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"[**Download SDK**](https://github.com/Pushwoosh/pushwoosh-windows-sdk)\n[**W8 JS Sample**](https://github.com/Pushwoosh/pushwoosh-windows-sdk/tree/master/Samples/Win8.1JS)\n[block:callout]\n{\n  \"type\": \"success\",\n  \"title\": \"Supports Windows 8.1, Windows 10\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"SDK Integration\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"You can use an emulator while working with push notifications.\"\n}\n[/block]\nTo integrate Pushwoosh into your Windows 8 JS application, follow the steps below.\n\n**1.** Download our SDK package.\n\n**2.** Add reference to **PushSDK/Project-Win8.1-WNS/PushSDK.winmd** to your project\nOr **PushSDK/Project-Win10-WNS/PushSDK.winmd** if you develop for Windows 10\n\n**3.** Initialize push service with the following code:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var service = new PushSDK.NotificationService.getCurrent(\\\"YOUR_PUSHWOOSH_APP_ID\\\");\\n \\nservice.ononpushaccepted = function (args) {\\n    //code to handle push notification\\n    //display push notification payload for test only\\n    var md = new Windows.UI.Popups.MessageDialog(args.toString());\\n    md.showAsync()\\n}\\n \\nservice.ononpushtokenreceived = function (pushToken) {\\n    //code to handle push token\\n}\\n \\nservice.ononpushtokenfailed = function (error) {\\n    //code to handle push subscription failure\\n}\\n \\nservice.subscribeToPushService();\\n\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n**4.** In your **app.onactivated** function add the following:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"app.onactivated = function (args) {\\n        if (args.detail.kind === activation.ActivationKind.launch) {\\n            if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) {\\n                // TODO: This application has been newly launched. Initialize\\n                // your application here.\\n \\n                //Handle start push\\n                PushSDK.NotificationService.handleStartPush(args.detail.arguments);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Important!\",\n  \"body\": \"If you plan to use Toast notifications, please make sure Toast notifications are swithced on in your application project. Go to Application UI tab in manifest settings, and set **Toast Capable** to **Yes**. Otherwise, Toast notifications will not work on the device.\"\n}\n[/block]\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/j4vFMbCUTPex6bVc4OCX_ss1%20(1).png\",\n        \"ss1 (1).png\",\n        \"800\",\n        \"700\",\n        \"#7ba1c7\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nCakewalk!\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Advanced features\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Tags\"\n}\n[/block]\nWith tags, you can create a set of devices based on different criteria.\n\n**1.** Create a list of tags:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var keys = [\\\"name1\\\", \\\"name2\\\"];\\nvar values = [\\\"value1\\\", \\\"value2\\\"];\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n**2.** Send tags to Pushwoosh:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"service.sendTag(keys, values);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Geozones\"\n}\n[/block]\nYou can send push notifications to users located in a specific area.\n\n**1.** Turning Geo Zones on:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"service.startGeoLocation();\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n**2.** Turning Geo Zones off:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"service.stopGeoLocation();\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"windows-8-javascript-sdk","type":"basic","title":"Windows Javascript SDK"}

Windows Javascript SDK


[**Download SDK**](https://github.com/Pushwoosh/pushwoosh-windows-sdk) [**W8 JS Sample**](https://github.com/Pushwoosh/pushwoosh-windows-sdk/tree/master/Samples/Win8.1JS) [block:callout] { "type": "success", "title": "Supports Windows 8.1, Windows 10" } [/block] [block:api-header] { "type": "basic", "title": "SDK Integration" } [/block] [block:callout] { "type": "info", "body": "You can use an emulator while working with push notifications." } [/block] To integrate Pushwoosh into your Windows 8 JS application, follow the steps below. **1.** Download our SDK package. **2.** Add reference to **PushSDK/Project-Win8.1-WNS/PushSDK.winmd** to your project Or **PushSDK/Project-Win10-WNS/PushSDK.winmd** if you develop for Windows 10 **3.** Initialize push service with the following code: [block:code] { "codes": [ { "code": "var service = new PushSDK.NotificationService.getCurrent(\"YOUR_PUSHWOOSH_APP_ID\");\n \nservice.ononpushaccepted = function (args) {\n //code to handle push notification\n //display push notification payload for test only\n var md = new Windows.UI.Popups.MessageDialog(args.toString());\n md.showAsync()\n}\n \nservice.ononpushtokenreceived = function (pushToken) {\n //code to handle push token\n}\n \nservice.ononpushtokenfailed = function (error) {\n //code to handle push subscription failure\n}\n \nservice.subscribeToPushService();\n", "language": "javascript" } ] } [/block] **4.** In your **app.onactivated** function add the following: [block:code] { "codes": [ { "code": "app.onactivated = function (args) {\n if (args.detail.kind === activation.ActivationKind.launch) {\n if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) {\n // TODO: This application has been newly launched. Initialize\n // your application here.\n \n //Handle start push\n PushSDK.NotificationService.handleStartPush(args.detail.arguments);", "language": "javascript" } ] } [/block] [block:callout] { "type": "warning", "title": "Important!", "body": "If you plan to use Toast notifications, please make sure Toast notifications are swithced on in your application project. Go to Application UI tab in manifest settings, and set **Toast Capable** to **Yes**. Otherwise, Toast notifications will not work on the device." } [/block] [block:image] { "images": [ { "image": [ "https://files.readme.io/j4vFMbCUTPex6bVc4OCX_ss1%20(1).png", "ss1 (1).png", "800", "700", "#7ba1c7", "" ] } ] } [/block] Cakewalk! [block:api-header] { "type": "basic", "title": "Advanced features" } [/block] [block:api-header] { "type": "basic", "title": "Tags" } [/block] With tags, you can create a set of devices based on different criteria. **1.** Create a list of tags: [block:code] { "codes": [ { "code": "var keys = [\"name1\", \"name2\"];\nvar values = [\"value1\", \"value2\"];", "language": "javascript" } ] } [/block] **2.** Send tags to Pushwoosh: [block:code] { "codes": [ { "code": "service.sendTag(keys, values);", "language": "javascript" } ] } [/block] [block:api-header] { "type": "basic", "title": "Geozones" } [/block] You can send push notifications to users located in a specific area. **1.** Turning Geo Zones on: [block:code] { "codes": [ { "code": "service.startGeoLocation();", "language": "javascript" } ] } [/block] **2.** Turning Geo Zones off: [block:code] { "codes": [ { "code": "service.stopGeoLocation();", "language": "javascript" } ] } [/block]