phonegap 推送通知适用于 android 但不适用于 ios
phonegap push notification works on android but not on ios
正如标题所说,推送通知在 android 上工作正常,但在 IOS 上却不行。 push.on(registration...) 永远不会被调用。我已确保临时配置文件对开发和分发均有效。我正在为云使用 firebase messaging.I 正在寻找有关如何解决此问题的任何指导。
控制台输出如下:
2017-03-23 16:15:49.741405 [342:34586] Push Plugin register called
2017-03-23 16:15:49.741515 [342:34586] PushPlugin.register: setting badge to false
2017-03-23 16:15:49.741559 [342:34586] PushPlugin.register: clear badge is set to 0
2017-03-23 16:15:49.752879 [342:33926] Push Plugin register success: <######## ######## ######## ######## ######## ######## ######## ########>
.
document.addEventListener("deviceready", function() {
var push = PushNotification.init({
android: {
senderID: "############",
forceShow: true
},
ios: {
sound: true,
alert: true,
badge: true
}
});
push.on('registration', function(data) {
console.log('GCM: ' + data.registrationId);
$rootScope.pushRegStatus = true;
$rootScope.registerPushOnServer(data.registrationId);
});
push.on('notification', function(data) {
// data.message,
// data.title,
// data.count,
// data.sound,
// data.image,
// data.additionalData
// console.log('notification' + data.toString());
// App started by clicking on push notification ..
// if(data.additionalData.coldstart === false || data.additionalData.coldstart === true) {
// $location.path('/pushLog/' + data.additionalData.push_log_id);
// }
// Got notification while app is in foreground ..
if(data.additionalData.foreground) {
//$rootScope.alert(data.title, data.message);
} else {
$rootScope.alert(data.title, data.message);
// $location.path('/pushLog/' + data.additionalData.push_log_id);
$rootScope.openPushLogFromNotification = true;
// setTimeout(function() {
// $rootScope.openPushLogFromNotification = false;
// }, 3000);
$location.path('/pushLog');
}
});
push.on('error', function(e) {
// e.message
console.log(e);
});
}, false);
我通过跳过 firebase 并直接进入 APNS 来修复它
正如标题所说,推送通知在 android 上工作正常,但在 IOS 上却不行。 push.on(registration...) 永远不会被调用。我已确保临时配置文件对开发和分发均有效。我正在为云使用 firebase messaging.I 正在寻找有关如何解决此问题的任何指导。
控制台输出如下:
2017-03-23 16:15:49.741405 [342:34586] Push Plugin register called
2017-03-23 16:15:49.741515 [342:34586] PushPlugin.register: setting badge to false
2017-03-23 16:15:49.741559 [342:34586] PushPlugin.register: clear badge is set to 0
2017-03-23 16:15:49.752879 [342:33926] Push Plugin register success: <######## ######## ######## ######## ######## ######## ######## ########>
.
document.addEventListener("deviceready", function() {
var push = PushNotification.init({
android: {
senderID: "############",
forceShow: true
},
ios: {
sound: true,
alert: true,
badge: true
}
});
push.on('registration', function(data) {
console.log('GCM: ' + data.registrationId);
$rootScope.pushRegStatus = true;
$rootScope.registerPushOnServer(data.registrationId);
});
push.on('notification', function(data) {
// data.message,
// data.title,
// data.count,
// data.sound,
// data.image,
// data.additionalData
// console.log('notification' + data.toString());
// App started by clicking on push notification ..
// if(data.additionalData.coldstart === false || data.additionalData.coldstart === true) {
// $location.path('/pushLog/' + data.additionalData.push_log_id);
// }
// Got notification while app is in foreground ..
if(data.additionalData.foreground) {
//$rootScope.alert(data.title, data.message);
} else {
$rootScope.alert(data.title, data.message);
// $location.path('/pushLog/' + data.additionalData.push_log_id);
$rootScope.openPushLogFromNotification = true;
// setTimeout(function() {
// $rootScope.openPushLogFromNotification = false;
// }, 3000);
$location.path('/pushLog');
}
});
push.on('error', function(e) {
// e.message
console.log(e);
});
}, false);
我通过跳过 firebase 并直接进入 APNS 来修复它