0

I have a very simple Cordova app with push notifications. I'm using VS2015 Update 1 with the latest Cordova toolset (Update 7) and a properly setup Azure App Service. When I run a RELEASE Win10 x64 version of the application through VS, I receive push notifications as expected. But, when I run a DEBUG version of the same application (with no source changes), I don't get push notifications and the sender receives the error:

The Token obtained from Token Provider is wrong

Both applications are Windows 10, running on Local Machine x64 (not a simulator).

This behavior is not consistent. I have another VS2015 Cordova project that works fine with push notifications in both release and debug modes.

Is there some setting I'm missing in VS or Azure that controls this behavior?

SamG
  • 815
  • 8
  • 12

1 Answers1

3

After a day of frustration, I determined the VS2015 difference in behavior between Debug & Release Windows Store packages. It's possible this was introduced in Update 7 of the Apache toolset.

In brief, VS2015 does not sign the Debug package with the Windows Store publisher ID. This causes some functionality, like push notifications, to not work. To resolve this, edit the build.json file for the Cordova project and add an entry for the debug build that forces VS to use your Windows Store publisher cert. The file should like the below after you're done (mine was missing the debug section) - and of course put in your Windows Store published ID in the placeholders:

{
  "windows": {
    "release": {
      "packageCertificateKeyFile": "res\\native\\windows\\CordovaApp.pfx",
      "publisherId": "CN=<InsertYourWinStorePubIdHere>"
    },
    "debug": {
      "packageCertificateKeyFile": "res\\native\\windows\\CordovaApp.pfx",
      "publisherId": "CN=<InsertYourWinStorePubIdHere>"
    }
  }
}
SamG
  • 815
  • 8
  • 12