【问题标题】:Push Notification Android with ionic framework带有离子框架的推送通知Android
【发布时间】:2015-07-21 12:52:37
【问题描述】:

我正在尝试从我的服务器向我的 Android 设备发送推送通知。使用 Plug 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"}]}

尝试卸载我手机上的应用程序并重新安装,但没有,这对我不起作用。

【问题讨论】:

  • 发件人 id 是你的项目 id 805573676421 所以把你的var androidConfig = { "senderID": "inspired-berm-101218", };改成var androidConfig = { "senderID": "805573676421", };
  • 我为此medium.com/@ezeezegg/…创建了一个项目和教程,代码在github.com/ezegg/ionic-push中可用

标签: android cordova push-notification ionic-framework


【解决方案1】:

立即使用此网站创建并再次运行应用程序,它会提供准确的数据。

Google Developers

【讨论】:

    猜你喜欢
    • 2014-05-28
    • 1970-01-01
    • 2017-06-10
    • 2016-07-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多