Hi,
I am trying to use this $cordovaPush plugin
I installed it using this command
cordova plugin add https://github.com/phonegap-build/PushPlugin.git
I placed code inside my document ready method
var iosConfig = {
“badge”: true,
“sound”: true,
“alert”: true
};
document.addEventListener(“deviceready”, function(){
console.log('came in document ready');
$cordovaPush.register(iosConfig).then(function(result) {
// Success -- send deviceToken to server, and store for future use
console.log("result: " + result);
alert('result ' + result);
}, function(err) {
alert("Registration error: " + err)
});
$rootScope.$on('$cordovaPush:pushNotificationReceived', function(event, notification) {
if (notification.alert) {
navigator.notification.alert(notification.alert);
}
if (notification.sound) {
var snd = new Media(event.sound);
snd.play();
}
if (notification.badge) {
$cordovaPush.setBadgeNumber(notification.badge).then(function(result) {
// Success!
}, function(err) {
// An error occurred. Show a message to the user
});
}
});
}, false);
also passed $cordovaPush in .run method
like this
.run(function($ionicPlatform, $cordovaSQLite,$cordovaPush)
and also linked push notification.js to index file before cordova.js
I am able to get notification token, but problem is, other plugins like console doesn’t work after I install this plugin. I am trying to figure out this problem from last 4 days now.
I have tested my app after removing this plugin, it works perfect without this plugin.
Do any one here had this problem before? I tried to search other posts here related to push notification but didn’t found anything related.
@max any suggestion on this?