Windows phone Push Notifications WNS

Hi there,

We are currently developing an ionic 2 app and managed to get iOS and Android push notifications working (using SNS). However, for windows phones, the device subscribe but to the endpoint (WNS - platform application in SNS) but does not receive any push notifications? has any of you managed to get it working? Any clue would be greatly appreciated.

Thank you.

Sylvain

Could you post your notification payload and Ionic 2 code for push notifications?

Our registration code works fine, we’re receiving a https://hk2.notify.windows.com/?token=XXXX URL which is posted to our API which creates a platform endpoint in SNS and returns an EndpointArn.

This code is working on other iOS and Android, however the notification event is never triggering on Windows Phone 10. I’ve tried running this on a Lumia 550 running Windows 10 Mobile (10.0.10586.545)

Here is the relevant code, all of which is triggered by a function call inside the platform.ready() callback:

let push = PushNotification.init({
  android: {
    senderID: "XXXX",
    icon: "icon",
    iconColor: 'yellow'
  },
  ios: {
    alert: "true",
    badge: "1"
  },
  windows: {}
});

// This method is successfully triggered
push.on('registration', (data) => {
  console.log(data.registrationId);
  
  this.dataService.writeString('device-id', data.registrationId);

  let body = {
    'data': {
      'uuid': window['device']['uuid'],
      'push_token': data.registrationId
    }
  };
  let headers = new Headers({'Content-Type': 'application/json'});
  let options = new RequestOptions({headers: headers});
  let modelName: any = '';

  this.dataService.databaseRequest('model-id')
      .then(data => {
        modelName = data;

        // This POSTs the registrationId to our API, 
        // API creates a platform endpoint and subscribes it to a topic
        this.http.post(this.dataService.apiRoot + '/devices/' + modelName + '/subscribe', body, options)
            // logs the new endpoint ARN to the console
            .subscribe(response => console.log(response));
      });
});

// This method should be called when receiving a notification sent from the SNS control panel.
push.on('notification', (data) => {
  console.log(data);
});

push.on('error', (e) => {
  console.log(e.message);
});

The test payload is being sent through the Amazon SNS dashboard, we have tried both a raw payload with just a string, and this payload from their json message generator

{
"WNS" : "<badge version\"1\" value\"23\"/>"
}

I am also experiencing exactly the same problem. Has your issue solved?