【发布时间】:2018-12-17 03:08:57
【问题描述】:
我无法从 Firebase 获得通知以显示。我按照here 提供的教程进行操作。可能是什么问题呢?
сode example :
setupPush: function() {
var push = PushNotification.init({
"android": {
"senderID": "966613396976",
"sound": true,
"vibration": true,
"badge": true
},
"browser": {},
"ios": {
"sound": true,
"vibration": true,
"badge": true
},
"windows": {}
});
push.on('registration', function(data) {
test(data);
var oldRegId = localStorage.getItem('registrationId');
if (oldRegId !== data.registrationId) {
localStorage.setItem('registrationId', data.registrationId);
}
});
push.on('error', function(e) {
console.log("push error = " + e.message);
});
push.on('notification', function(data) {
console.log('notification event');
navigator.notification.alert(
data.message, // message
null, // callback
data.title, // title
'Ok' // buttonName
);
});
}
};
【问题讨论】:
-
你能对答案提供反馈吗?
标签: firebase notifications push phonegap