@Freier wrote:
Hello,
I need a little bit help.
I send push notification to my app and when a message arrived I would like open an popup dialog and after press OK, redirect the user to a page. Everything is working. But the dialog opens not one time, I opens 3-6 times and the redirect the user????This is my code:
.service('PushNotificationsService', function ($rootScope, $cordovaPush, $ionicPopup, $state){
console.log('Notification');this.register = function() {
var config = {};
if(ionic.Platform.isIOS())
{
console.log("Notification IOS");
config = {
"badge": true,
"sound": true,
"alert": true
};$cordovaPush.register(config).then(function(result) {
// Success -- send deviceToken to server, and store for future use
console.log("iOS push notification registration success", result);
window.localStorage.setItem('device_token', result);
}, function(err) {
console.log("iOS push notification registration error", err);
});
$rootScope.$on('$cordovaPush:notificationReceived', function(event, notification) {
console.log(notification.alert, "Push Notification Received");if(notification.confirmation) { console.log('PopUp') var alertPopup = $ionicPopup.alert({
title: 'Title',
template: 'Message. '
}).then(function(res) {
$state.go('app.appointmentDetail', {appointment_id: notification.confirmation});
});
}
});
}
}
});Thanks for your support
BR Thomas
Posts: 1
Participants: 1