接收推送通知

要接收推送通知,我們應該告訴外掛監聽傳入的推送通知。此步驟在初始化和註冊後完成

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));
       });