Как удалить заголовок push-уведомления с помощью плагина phonegap-plugin-push в ionic 1 & AWS - PullRequest
0 голосов
/ 10 июля 2019

Я хочу удалить заголовок из push-уведомления.

Я использую phonegap-plugin-push в своем приложении ionic 1 и SNS из AWS.

Я попытался удалить заголовок из полезной нагрузки, ноавтоматически устанавливает имя приложения в качестве заголовка уведомления.

    var options = {
                  android: {
                      /*senderID: "1021482754607",*/
                      senderID: "100869037213",
                      icon : "ic_stat_login_logo",
                      iconColor : "#106A9E"
                  },
                  ios: {
                      alert: "true",
                      badge: "true",
                      sound: "true",
                      clearBadge: "false"
                  },
                  windows: {}
              };
              $cordovaPushV5.initialize(options).then(function() {
                  // start listening for new notifications
                  $cordovaPushV5.onNotification();
                  // start listening for errors
                  $cordovaPushV5.onError();
                  //register function
                  $cordovaPushV5.register().then(function(registrationId) {
                      localStorage.setItem('gcmKey', registrationId);
                  }, function(error) {
                      var date = new Date();
                      localStorage.setItem('gcmKey', 'not-registered');
                  })
              });



//push notifications listener
        $rootScope.$on('$cordovaPushV5:notificationReceived', function(event, data){
            var message = data.additionalData;
            console.log('Push Notification ->  ', data);
            if(ionic.Platform.isAndroid()) {
                if (data && data.additionalData && data.additionalData.custom) {
                    message = data.additionalData.custom;
                }
                message.coldstart = data.additionalData.coldstart;
                message.foreground = data.additionalData.foreground;
            }
            //app is open and push received
            if(message.foreground) {
                //ref.localNotify(data);
                //TODO : need to fix the notification places
                $cordovaToast.show(data.message, 'long', 'center');
            } else {
                switch(message.type) {
                    case 'Gift' : {
                        $timeout( function(){
                            $state.go(message.url,{'messageId' : message.msgId ,'recipientId' : message.recipientId});
                        }, 2000 );
                        break;
                    }
                    default : {
                        $timeout( function(){
                            $state.go(message.url,{'calendarId':message.calendarId});
                        }, 2000 );
                        break;
                    }
                };
            }
        });

Я ожидаю, как я могу удалить заголовок из push-уведомления.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...