I am working Cordova iOS Platform. I need to add Push Notification in my Project.
Steps:
I have created a project in Google console and created a Project-ID.
Created a APNS PushNotification Production Certificate from Apple Developer.
Below Plugin Added in my Project
cordova plugin add phonegap-plugin-push --variable SENDER_ID="722784892462"
In index.js
var pushNotification;
gcmNotification = {
onNotificationAPN : function (e) {
if (e.id)
{
navigator.notification.beep();
}
},
registerPushNotification : function () {
try{
pushNotification = window.plugins.pushNotification;
var errorHandler = function (error) {
console.log(error);
};
var tokenHandler = function (result) {
alert('device token = ' + result);
};
pushNotification.register(tokenHandler, errorHandler, { "badge": "true", "sound": "true", "alert": "true", "ecb": "onNotificationAPN" });
}catch(e){
exceptionAlert("registerPushNotification>>"+e);
}
}
}
function onNotificationAPN(e)
{
gcmNotification.onNotificationAPN(e);
}
I tried in my real device.
I got the Below error: