$ ionicPush.register没有注册设备

时间:2016-08-30 10:51:54

标签: ionic-framework

我创建了一个非常简单的应用程序,尝试使用ionic.io服务进行离子推送通知。我创建了一个空白离子1应用程序。添加了离子云插件。添加了phoegap-plugin-push插件。这是我的app.js代码:

angular.module('starter', ['ionic','ionic.cloud'])

.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
    if(window.cordova && window.cordova.plugins.Keyboard) {
      // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
      // for form inputs)
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);

      // Don't remove this line unless you know what you are doing. It stops the viewport
      // from snapping when text inputs are focused. Ionic handles this internally for
      // a much nicer keyboard experience.
      cordova.plugins.Keyboard.disableScroll(true);
    }
    if(window.StatusBar) {
      StatusBar.styleDefault();
    }
  });
})

    .config(function($ionicCloudProvider) {
        $ionicCloudProvider.init({
            "core": {
                "app_id": "XXXXXXX"
            },
            "push": {
                "sender_id": "XXXXXXXXXX",
                "pluginConfig": {
                    "ios": {
                        "badge": true,
                        "sound": true
                    },
                    "android": {
                        "iconColor": "#343434"
                    }
                }
            }
        });
    })

    .run(function($ionicPlatform,$ionicPush) {
        $ionicPush.register().then(function(t) {
            return $ionicPush.saveToken(t);
        }).then(function(t) {
            console.log('Token saved:', t.token);
        });


    })

;

当我记录响应时,我收到此消息:

Ionic Push:已保存的推送令牌:[object Object] ionic.cloud.min.js:1 令牌已保存:cIiJ-TlvXyM:APA91bGKZZi_4XlfMLyY2C7-lwFiLYbqYjk7_4MwtQU7TyqHvLeKgdMPVuMOYpGshkmenunaF6Re1fKky6lP1aBK-Ik9NZJqp2XCIFFo8EAP6Cytn-cY7cRREAK5x69Ji3P-ZFpqNKw4

但是当我在ionic.io仪表板上查看我的应用程序时,我找到了用户并且没有用户注册。

任何想法?

0 个答案:

没有答案