Open Zeladgolan opened 8 years ago
Could be an issue in the underlying plugin and not the wrapper. Which push plugin wrapper are you using? And are there any open issues on the Cordova plugin page about Marshmellow?
This is wrapper I've used. http://ngcordova.com/docs/plugins/pushNotifications/
@Zeladgolan You should use $cordovaPushV5 for notifications, because previous version is deprecated. Look at available methods here https://github.com/driftyco/ng-cordova/blob/master/src/plugins/push_v5.js
Thanks @vitaliy-bobrov, Should I just replace the js file or install the whole plugin? cordova plugin rm cordova new_plugin add?
@Zeladgolan here a bit of tested code:
angular.module('myApp', ['ngCordova'])
.run(function ($cordovaPushV5) {
var pushConfig = {
android: {
senderID: "_YOUR_ID_"
},
ios: {
alert: "true",
badge: "true",
sound: "true"
},
windows: {}
};
document.addEventListener("deviceready", function () {
$cordovaPushV5.initialize(pushConfig)
.then(function (push) {
push.on('notification', function (notification) {
// WHAT TO DO ON PUSH NOTIFICATION?
// CHANGE FOLLOWING CODE ACCORDING TO YOUR NEEDS
alert(JSON.stringify(notification));
});
});
$cordovaPushV5.register().then(function (result) {
// Success
alert("Successfully registered for PUSH NOTIFICATION: " + result);
}, function (err) {
// Error
alert("Error registering for PUSH NOTIFICATION: " + err);
});
});
});
When upgrading to the new Android version suddenly the push notifications weren't received.