Я работаю Cordova iOS Платформа. Мне нужно добавить Push Notification в моем проекте.iOS PushPlugin Cordova выпуск в регистрации
Шаги:
Я создал проект в консоли Google и создал Project-ID.
Создал сертификат производителя APNS PushNotification от Apple Developer.
Ниже Plugin Добавлено в моем проекте
cordova plugin add phonegap-plugin-push --variable SENDER_ID="722784892462"
В 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);
}
Я пытался в моем реального устройства.
я получил ошибку ниже:
cordova.js уже добавлены. Мои другие плагины работают отлично, за исключением этого – GaneshKumar
Я попробовал, чтобы это работало для меня. проверьте этот URL https://github.com/phonegap-build/PushPlugin –