简体   繁体   English

带离子框架的推送通知Android

[英]Push Notification Android with ionic framework

I'm trying to send push notifications to my Android device from my server. 我正在尝试从服务器向我的Android设备发送推送通知。 Using plug PushNotification Cordova, my code is something. 使用插件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);

My information according to me, I followed advice from this forum and tutorials are good and are these: 根据我的个人资料,我遵循了该论坛的建议,并且教程很好,这些是:

Api KEY : AIzaSyDtZndyGvmWXF0TpYe83KVDgxRZ4MR3zK8 api密钥:AIzaSyDtZndyGvmWXF0TpYe83KVDgxRZ4MR3zK8

ID del proyecto: inspired-berm-101218 ID del proyecto:启发性的床-101218

Número del proyecto: 805573676421 Numero del proyecto:805573676421

All this I use both my application and server are the same codes, but nevertheless, I receive the error: 我在应用程序和服务器上使用的所有代码都是相同的代码,但是仍然收到错误消息:

{"multicast_id":7843752850335107662,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"MismatchSenderId"}]}

Try uninstalling the application on my phone and reinstall but nothing, does not this work for me. 尝试在手机上卸载该应用程序并重新安装,但没有任何帮助,这对我来说不起作用。

Use this website to create and run the application again immediately, it gives the exact data. 使用此网站可以立即创建并再次运行该应用程序,它会提供准确的数据。

Google Developers Google开发人员

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM