Open joshilomas opened 10 years ago
As i understand i can put any value for channelName. But now the problem is that, Inside channelHandler function i get data with channelName and empty uri. what does uri means here? what is problem with my code? Any help??
hi josh, i'm facing the same problem here. i've successfully implemented push notifications for android app with a custom made back office using push plugin and PushSharp.
Now i'm trying implement for wp8 and can't find any support by microsoft or any good tuturial.
if you or anybody find anything let me know please.
Regards
Hello postixo, now i have successfully implemented Toast notification for wp8 phone. The uri is the what actually we need for push notification in wp8 phone. Get this uri and send this to your server for later use. Here's the sample code. As in am working with angularjs so the code is in the format of anguarjs.
.factory('MPNS', function ($window){ var storage = window.localStorage;
function registerMPNS(){
var pushNotification;
pushNotification = window.plugins.pushNotification;
pushNotification.register(
channelHandler,
errorHandler,
{
"channelName": "xyz", //channelName is whateveryou like
"ecb": "onNotificationWP8",
"uccb": "channelHandler",
"errcb": "jsonErrorHandler"
});
}
$window.onNotificationWP8 = function(e){
}
function channelHandler(event){
var uri = event.uri;
//This is the uri you need for push notification }
function errorHandler(e){
}
function successHandler(e) {
}
return{
register: function(){
return registerMPNS();
}
};
});
sometimes MPNS does reply empty uri. so check wheather you get uri or not while your app starts.
Hi joshilomas.
For testing purposes, do I need to install from the store? Or is there a mechanism for linking the app installed via USB with the Client secret, etc?
Thanks!
Hello joshilomas,
My uri is always empty. I don't get fix the problem with a your example using angularjs.Your application is still working? Are you could send the html code complete?
fabiofapeli, you have to ask for the uri several times. yes, so strange, but Microsoft is Microsoft :)
@joshilomas your code is clean , can you write a blog about it so that everyone can see when they google it instead of coming here :)
Over a year later and Cordova & WP8 still has garbage information on doing this (or really anything) for the Windows Phone. I am now in the same boat as you all.
Anyone please help me out for Integrating Push Notification in Windows Phone Cordova.
For me its working fine.
just keep loop RegisterMPNS Function until unless you are not getting uri.
function registerMPNS(){ var pushNotification; pushNotification = window.plugins.pushNotification; pushNotification.register( channelHandler, errorHandler, { "channelName": "xyz", //channelName is whateveryou like "ecb": "onNotificationWP8", "uccb": "channelHandler", "errcb": "jsonErrorHandler" }); }
$window.onNotificationWP8 = function(e){
}
function channelHandler(event){ var uri = event.uri; if(uri==''){ registerMPNS(); } }
I have easily applied push notification service for my android app, but confused how to do in windows phone.
if(device.platform == "Win32NT"){ pushNotification.register( channelHandler, errorHandler, { "channelName": channelName, "ecb": "onNotificationWP8", "uccb": "channelHandler", "errcb": "jsonErrorHandler" }); }
I doesn't understand what the above parameters. eg: channelName. where can i get the values for these parameters??
Also, does anyone give me the link to full tutorial applying PNS in wp8 including server side too?
Regards, Lomas Joshi