Hey there,
I’m developing an app for a conference and we want to implement pushnotifications. I just registered me for the service Pushwoosh and set the GCM up and also the pushwoosh app itself.
I think i just implemented it wrong in my app.
I did the steps from here: https://www.pushwoosh.com/programming-push-notification/android/android-additional-platforms/phonegapcordova-sdk-integration/
I put the first function in a extra file pushnotification.js
function initPushwoosh()
{
var pushNotification = window.plugins.pushNotification;
//set push notifications handler
document.addEventListener('push-notification', function(event) {
var title = event.notification.title;
var userData = event.notification.userdata;
if(typeof(userData) != "undefined") {
console.warn('user data: ' + JSON.stringify(userData));
}
alert(title);
});
//initialize Pushwoosh with projectid: "GOOGLE_PROJECT_ID", appid : "PUSHWOOSH_APP_ID". This will trigger all pending push notifications on start.
pushNotification.onDeviceReady({ projectid: "GOOGLE_PROJECT_ID", appid : "PUSHWOOSH_APP_ID" });
//register for pushes
pushNotification.registerDevice(
function(status) {
var pushToken = status;
console.warn('push token: ' + pushToken);
},
function(status) {
console.warn(JSON.stringify(['failed to register ', status]));
}
);
}
and in the
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {...
i put this
document.addEventListener("deviceready", initPushwoosh, true);
if i now want to send a test notification nothing happens. What did I wrong implementing this?
(of course i did all the other steps from that guide!)
Best regards,
Luc