phonegap / phonegap-plugin-push

Register and receive push notifications
MIT License
1.94k stars 1.91k forks source link

WNS Notifications to Windows 10 device, via Amazon SNS #837

Closed cjpete closed 8 years ago

cjpete commented 8 years ago

Actual Behaviour

Push notification never reaches the device, and is rejected by WNS. I have checked the package SID and the client secret and both of these are correctly configured in the cloud service.

Steps to Reproduce

  1. Initialise plugin with empty object
  2. Receive WNS endpoint URL from "registration" event
  3. Send push notification to endpoint, via Amazon SNS

    Platform and Version (eg. Android 5.0 or iOS 9.2.1)

Windows 10.0.10586.0 - Surface Pro 4

Cordova CLI version and cordova platform version

Cordova Version: 6.1.1 Cordova Windows Platform Version: 4.3.2

Plugin version

1.5.3

Sample Push Data Payload

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

Sample Code that illustrates the problem

I am just passing an empty object into PushNotification.init(), and the token is being correctly retrieved and submitted to the cloud service I am using - Amazon SNS.

From what I can read, the status codes being returned indicate that the app is not authorised for receiving push notifications, however, in my config.xml file, I have the following preference: <preference name="WindowsToastCapable" value="true" />

Logs taken while reproducing problem

{
    "notification": {
        "messageMD5Sum": "33be0b3c1913b17f397acdab137576e4",
        "messageId": "12d078d3-0023-5622-a18f-374b3269bb54",
        "timestamp": "2016-04-25 14:56:10.597"
    },
    "delivery": {
        "deliveryId": "0ea2e110-92d1-5bea-9a92-ae88a09a8438",
        "destination": "**[Redacted - EndPoint ARN]**",
        "providerResponse": "X-WNS-NOTIFICATIONSTATUS: dropped\nX-WNS-STATUS: dropped\n",
        "dwellTimeMs": 430,
        "attempts": 1,
        "token": "https://db5.notify.windows.com/?token=**[Redacted - Token URL parameter]**",
        "statusCode": 403
    },
    "status": "FAILURE"
}

Additional Questions

  1. How should the device be notified that the Windows app is expecting to receive push notifications?
  2. Do you have any detailed installation instructions for the WNS integration?
  3. Is this plugin only supporting Windows 10 and Windows 10 Mobile? I.e. Windows 8.X and Windows Phone 8.X are not supported?
rakatyal commented 8 years ago

403 could also mean that the access token doesn't match the credentials of the app which asked for the channel URI. Could you check that the package name in your app's manifest matches the cloud service credentials given to your app in the Dashboard?

To answer your additional questions:

  1. I don't understand what you mean here. Why/when would this be needed?
  2. This is a good tutorial.
  3. This supports windows 8.1 and windows phone 8.1 as well. It doesn't support windows phone 8.
cjpete commented 8 years ago

@rakatyal Regarding Q1: When the plugin fires the 'registration' event on iOS devices, the user is prompted to allow Push Notifications. The same thing doesn't seem to happen on Windows.

rakatyal commented 8 years ago

I am not aware of any permission settings on windows platform. So that's expected behavior.

agupta-elementum commented 7 years ago

Hello,

We are also facing the same problem with same response from Amazon SNS as mentioned by @cjpete in his original question.

I am using version 2.0.x version of the plugin (because I have to use FCM for Android) Cordova Version: 6.4.0 Cordova Windows platform version: 3.9.0-dev

Since, SNS is returning 403 I have verified that the package name in my manifest is same as specified in the Windows Store's App's Dashboard. In fact I copy-pasted the tab from the dashboard in my app's manifest.

Were you able to find a solution to this problem?

cjpete commented 7 years ago

@agupta-elementum - I no longer have access to the code, but if I recall correctly it was resolved by signing the app package with a valid certificate in VS.

agupta-elementum commented 7 years ago

Thanks for the reply @cjpete but we are signing the app with a valid certificate and that's how the app is able to run on the device. By the way, I am installing the app on the phone using Visual Studio's Debug option.

agupta-elementum commented 7 years ago

@cjpete , thanks for your help. Initially I was manually copying the Package Name and Publisher ID from the Store Dashboard to app's manifest file and Push Notification was not received by the app even though Secret Key and SID were right. Now, I used Visual Studio's Associate App to Store feature. It downloaded correct certificate. When I used this to sign my app (in manifest's Packaging tab) the notification was received fine.

lock[bot] commented 6 years ago

This thread has been automatically locked.