Search code examples
push-notificationwindows-phone-8.1windows-store-appswns

WNS Notification : Channel URL incompatible with caller app


I'm currently developping an mobile application based on Cordova (version 4.0.0) for Windows Phone 8.1.

I implemented the Java code from API Java-WNS (from github of fernandospr) to send notification to my device.

When I push the notification message to WNS, I get this error :

Client in-bound response
403
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-WNS-DEBUG-TRACE: DB5SCH101111133
Date: Fri, 22 Jan 2016 10:44:55 GMT
Content-Length: 0
X-WNS-STATUS: dropped
X-WNS-ERROR-DESCRIPTION: Channel URL incompatible with caller app
X-WNS-MSG-ID: 6D850FC61AE7FDB5
X-WNS-NOTIFICATIONSTATUS: dropped

Here's the different steps to configure my app to receive notifications :

  • I registered my app from windows developper dashboard
  • I have a SID package : ms-app://s-1-15-2-[...]-[...]-[...]-[...]-[...]-[...]-[...]-2403721117
  • I have also my client secret like this (just an example) : Nk2C+pmadqcHNQR51lN6F7LGaJYUTRPb
  • This is my channel URI obtained from WNS :

    https://db5.notify.windows.com/?token=AwYAAAD8sfbDrL9h7mN%2bmwlkSkQZCIfv4QKeu1hYRipj2zNvXaMi9ZAax%2f6CDfysyHp61STCO1pCFPt%2b9L4Jod72JhIcjDr8b2GxuUOBMTP%2b6%2bqxEfSB9iZfSATdZbdF7cJHSRA%3d
    
  • Most important, I associated my app to windows store from Visual Studio. Then, package name, publisher display and publisher ID have been added to my appxmanifest.file

Here's the appxmanifest.file (truely name "package.phone.appxmanifest from platforms/windows folder and cordova windows phone project) :

<?xml version='1.0' encoding='utf-8'?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest" xmlns:m3="http://schemas.microsoft.com/appx/2014/manifest" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest">
    <Identity Name="company-name.70**********2" Publisher="CN=02******-****-****-****-***********9" Version="1.1.0.0" />
    <mp:PhoneIdentity PhoneProductId="06******-****-****-****-**********k" PhonePublisherId="s*******-****-****-****-***********5" />
    <Properties>
        <DisplayName>Demo Windows App Phone</DisplayName>
        <PublisherDisplayName>My Company Name</PublisherDisplayName>
        <Logo>images\StoreLogo.png</Logo>
    </Properties>
    <Prerequisites>
        <OSMinVersion>6.3.1</OSMinVersion>
        <OSMaxVersionTested>6.3.1</OSMaxVersionTested>
    </Prerequisites>
    <Resources>
        <Resource Language="x-generate" />
    </Resources>
    <Applications>
        <Application Id="com.company-name.demo" StartPage="www/index.html">
            <m3:VisualElements BackgroundColor="transparent" Description="CordovaApp" DisplayName="Demo Windows App Phone" ForegroundText="light" Square150x150Logo="images\Square150x150Logo.png" Square44x44Logo="images\Square44x44Logo.png">
                <m3:DefaultTile Square71x71Logo="images\Square71x71Logo.png" Wide310x150Logo="images\Wide310x150Logo.png">
                    <m3:ShowNameOnTiles>
                        <m3:ShowOn Tile="square150x150Logo" />
                        <m3:ShowOn Tile="wide310x150Logo" />
                    </m3:ShowNameOnTiles>
                </m3:DefaultTile>
                <m3:SplashScreen Image="images\SplashScreenPhone.png" />
            </m3:VisualElements>
            <ApplicationContentUriRules>
                <Rule Match="https://dev.company-name.fr/demo-windows-app/*" Type="include" />
            </ApplicationContentUriRules>
        </Application>
    </Applications>
    <Capabilities>
        <Capability Name="internetClientServer" />
        <DeviceCapability Name="webcam" />
        <DeviceCapability Name="microphone" />
    </Capabilities>
</Package>

From server side, I use the authentification to WNS with two parameters :

  • SID package
  • Client secret password

I checked differents topics about this error and the most of the useful answer is to associate the app to windows store. But I always did it and I don't work for me.

If I understand well, WNS platform just need to know the ID App (SID package) to find my app and to send notification to my app. I don't need to deploy my app through the windows store.

Do you have an idea about how to fix it ? Do you think I forget something or do a mistake ?

EDIT :

I'm thinking I find the problem ! I'm working on it and when I'll resolve my problem, I'll come back here to post my solution.


Solution

  • I found the solution about my problem. I'm stupid because I didn't see the relationship between the association of my app to windows store and the appx archive which must have generated. I deployed the wrong appx and that's why I never received the notifications windows. In fact, the wrong appx was never associated to the windows store...

    So, here's the steps (from Visual Studio 2015 RC) to deploy the appx archive linked to windows store :

    • Go to project tab and select windows store
    • Click on create app packages
    • Following the differents steps to generate an appx archive with the windows store informations associated (one of steps will be associate your app with the windows store)
    • the appx archive generated is stored to the following folder (in my case) : C:\Users\pcharpin\Documents\Visual Studio 2015\Projects\demo-app-windows\demo-app-windows\AppPackages\CordovaApp.Phone_1.1.0.0_arm_Test
    • To deploy this archive on your remote device, use the Windows Phone Application Deployment 8.1 tool. Select target as remote device and select also the app package which is CordovaApp.Phone_1.1.0.0_arm_Test. To finish, click on deploy and your app will be deploy on your remote device.
    • You're ready to send notifications windows and receive them to your windows phone device

    So, don't forget to create an app package to associate it to the windows store and can receive the notifications windows.

    You can retrieve the guidelines about this from documentation of Create a Windows 8.1 app package (excepted about the deployment's step).