使用离子框架推送通知 Android
Push Notification Android with ionic framework
我正在尝试从我的服务器向我的 Android 设备发送推送通知。使用插件PushNotification Cordova,我的代码有点东西。
var androidConfig = {
"senderID": "inspired-berm-101218",
};
document.addEventListener("deviceready", function(){
$cordovaPush.register(androidConfig).then(function(result) {
// Success
}, function(err) {
// Error
})
$rootScope.$on('$cordovaPush:notificationReceived', function(event, notification) {
switch(notification.event) {
case 'registered':
if (notification.regid.length > 0 ) {
alert('registration ID = ' + notification.regid);
sessionService.set("token_device",notification.regid);
根据我的信息,我听从了这个论坛的建议,教程很好,这些是:
Api 密钥:AIzaSyDtZndyGvmWXF0TpYe83KVDgxRZ4MR3zK8
项目 ID:inspired-berm-101218
项目编号:805573676421
我使用的所有这些我的应用程序和服务器都是相同的代码,但是,我收到错误:
{"multicast_id":7843752850335107662,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"MismatchSenderId"}]}
尝试在我的 phone 上卸载应用程序并重新安装,但没有任何效果,这对我不起作用。
使用此网站创建并立即再次运行应用程序,它提供了准确的数据。
我正在尝试从我的服务器向我的 Android 设备发送推送通知。使用插件PushNotification Cordova,我的代码有点东西。
var androidConfig = {
"senderID": "inspired-berm-101218",
};
document.addEventListener("deviceready", function(){
$cordovaPush.register(androidConfig).then(function(result) {
// Success
}, function(err) {
// Error
})
$rootScope.$on('$cordovaPush:notificationReceived', function(event, notification) {
switch(notification.event) {
case 'registered':
if (notification.regid.length > 0 ) {
alert('registration ID = ' + notification.regid);
sessionService.set("token_device",notification.regid);
根据我的信息,我听从了这个论坛的建议,教程很好,这些是:
Api 密钥:AIzaSyDtZndyGvmWXF0TpYe83KVDgxRZ4MR3zK8
项目 ID:inspired-berm-101218
项目编号:805573676421
我使用的所有这些我的应用程序和服务器都是相同的代码,但是,我收到错误:
{"multicast_id":7843752850335107662,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"MismatchSenderId"}]}
尝试在我的 phone 上卸载应用程序并重新安装,但没有任何效果,这对我不起作用。
使用此网站创建并立即再次运行应用程序,它提供了准确的数据。