Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/190.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android $cordovaPush:notificationReceived调用了两次_Android_Ios_Angularjs_Push Notification_Ionic Framework - Fatal编程技术网

Android $cordovaPush:notificationReceived调用了两次

Android $cordovaPush:notificationReceived调用了两次,android,ios,angularjs,push-notification,ionic-framework,Android,Ios,Angularjs,Push Notification,Ionic Framework,我正在开发一个ionic应用程序,我需要推送通知,所以一切正常。我可以使用ionic推送通知接收通知,但回拨被调用两次,我只收到一个通知 这是我的密码: // the call back $rootScope.$on('$cordovaPush:notificationReceived', function (event, notification) {}); // the push service registration $ionicPush.register({

我正在开发一个ionic应用程序,我需要推送通知,所以一切正常。我可以使用ionic推送通知接收通知,但回拨被调用两次,我只收到一个通知

这是我的密码:

// the call back     
$rootScope.$on('$cordovaPush:notificationReceived', function (event, notification) {});

// the push service registration 
$ionicPush.register({
          canShowAlert: true, //Can pushes show an alert on your screen?
          canSetBadge: true, //Can pushes update app icon badges?
          canPlaySound: true, //Can notifications play a sound?
          canRunActionsOnWake: true, //Can run actions outside the app,
          onNotification: function(notification) {
            // Handle new push notifications here
            //$rootScope.$broadcast('$cordovaPush:notificationReceived',notification);
            return true;


          }
        });

谢谢

您是在使用数据库保存设备令牌还是在每次推送时手动提供@haffanehatimfor现在我只是手动添加它,用于ionic.io的测试通知,但它们将保存在生产数据库中