phonegap-build / PushPlugin

This repository is deprecated head to phonegap/phonegap-push-plugin
https://github.com/phonegap/phonegap-plugin-push
MIT License
1.31k stars 996 forks source link

Windows notifications (WP 8.1) - Unable to connect to WNS from client mobile app #659

Closed charpin closed 8 years ago

charpin commented 8 years ago

From my windows mobile application, I want to implement the windows notifications.

My mobile application is based on :

To implement this feature, I'm using the cordova plugin "phonegap-push-plugin" (version 1.4.5).

When my mobile application is launched for the first time, I ask to my application to connect to the notification client platform. The goal is this notification client platform ask to WNS to return a new notification channel (URI form) to my application.

When I use the method "registration" from PushNotification class :

var pushNotification = window.plugins.pushNotification;
        pushNotification.register(
             channelHandler,
             errorHandler,
             {
                 "channelName": "channelAppDemoWP",
                 "ecb": onNotificationWP8,
                 "uccb": channelHandler,
                 "errcb": jsonErrorHandler
             }
 );

function channelHandler(result) {
    console.log('registered on windows device = ' + result.uri);
    saveDevicetoken(result.uri);
}

function jsonErrorHandler(error) {
    console.log('Error register windows = ' + error);
}

function successHandler(result) {
    console.log('result = ' + result);
}

function errorHandler(error) {
    console.log('Error register = ' + error);
}

I get this error :

The notification client platform is unable to connect to the cloud notification service

I have the same error with the "phonegap-push-plugin" which not deprecated.

I thought the notification client platform is currently under maintenance. I found a file where are IP address ranges used by WNS. But when I ping differents IP address ranges and it works.

Is there anyone who already face this problem ? Or is there anyone who have an idea about how to fix it ?

charpin commented 8 years ago

I found the problem thanks to one of developper of PushPlugin from Issues.

I had not checked on my Windows Phone that data service is disabled. I thought by default that data service was activated. So, I activated the data service from my Windows Phone and the push notification works again.

So, we must verify the data service is activated on your Windows Phone before to execute push notification method.