Windows Javascript SDK
SDK 통합
Anchor link toPushwoosh를 Windows JS 애플리케이션에 통합하려면 아래 단계를 따르십시오.
1. SDK 패키지를 다운로드합니다.
2. 프로젝트에 PushSDK/Project-Win8.1-WNS/PushSDK.winmd에 대한 참조를 추가합니다.
또는 Windows 10용으로 개발하는 경우 PushSDK/Project-Win10-WNS/PushSDK.winmd를 추가합니다.
3. 다음 코드로 푸시 서비스를 초기화합니다:
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. app.onactivated 함수에 다음을 추가합니다:
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);
고급 기능
Anchor link to태그를 사용하면 다양한 기준에 따라 장치 세트를 만들 수 있습니다.
1. 태그 목록을 만듭니다:
var keys = ["name1", "name2"];var values = ["value1", "value2"];2. Pushwoosh로 태그를 보냅니다:
service.sendTag(keys, values);