接收推送通知

要接收推送通知,我们应该告诉插件监听传入的推送通知。此步骤在初始化和注册后完成

import { Push, NotificationEventResponse} from "ionic-native";
      
        //the push element is created in the initialization example      
        push.on("notification", (response: NotificationEventResponse) => {
            let chatMessage: ChatMessage = <ChatMessage>{
              title: response.title,
              message: response.message,
              receiver: response.additionalData.replyTo,
              image: response.image
            };
            DoStuff(chatMessage));
       });