When sending a push to our app, it fails to load when opening the app from the push itself (swiping the push to the left on iOS or to the right and then "view"). Is this avoidable / has anyone else encountered this problem?
Our push code is as follows:
function initPushwoosh()
{
//if android
if (ionic.Platform.isAndroid()){
var pushNotification = cordova.require("pushwoosh-cordova-plugin.PushNotification");
document.addEventListener('push-notification', function(event) {
swal(event.notification.title);
});
//initialize Pushwoosh with projectid: "GOOGLE_PROJECT_NUMBER", pw_appid : "PUSHWOOSH_APP_ID". This will trigger all pending push notifications on start.
pushNotification.onDeviceReady({ projectid: "REDACTED", pw_appid : "REDACTED" });
//register for pushes
pushNotification.registerDevice(
function(status) {
var pushToken = status;
console.warn('push token: ' + pushToken);
window.localStorage['PendingToken'] = pushToken;
},
function(status) {
console.warn(JSON.stringify(['failed to register ', status]));
}
);
}
//if ios
if (ionic.Platform.isIOS()) {
var pushNotification = cordova.require("pushwoosh-cordova-plugin.PushNotification");
//set push notification callback before we initialize the plugin
document.addEventListener('push-notification', function(event) {
console.log("ios: i am listening");
var notification = event.notification;
console.log("ios:notification is " + notification);
//clear the app badge
pushNotification.setApplicationIconBadgeNumber(0);
});
//initialize the plugin
pushNotification.onDeviceReady({pw_appid:"REDACTED"});
//register for pushes
pushNotification.registerDevice(
function(status) {
var deviceToken = status['deviceToken'];
console.warn('registerDevice: ' + deviceToken);
window.localStorage['PendingToken'] = deviceToken;
},
function(status) {
console.warn('failed to register : ' + JSON.stringify(status));
}
);
//reset badges on app start
pushNotification.setApplicationIconBadgeNumber(0);
}
}
Does the issue occur for iOS only or is it reproducible on Android as well? Also could you please provide us with a device output for opening your app by clicking on a notification?
When sending a push to our app, it fails to load when opening the app from the push itself (swiping the push to the left on iOS or to the right and then "view"). Is this avoidable / has anyone else encountered this problem?
Our push code is as follows: