2016-11-11 58 views
0

我在離子應用,我需要在應用程序中,當用戶在通知點擊打開特定網頁的工作,如何檢查是否應用在前臺科爾多瓦應用

代碼

 push.on('notification', function(data) { 
      window.plugins.toast.showShortTop('You have received a new Application!'); 
      window.location.hash = 'home/contactus'; 
     }); 

其工作罰款時,應用程序啓動開第一次。但問題是,當應用程序打開,到時候用戶得到任何通知應用重定向到「家/聯繫我們」頁面每次。 請幫助。

回答

0

不幸的是,推插件提高時收到通知,並再次單擊時通知事件。 你最好的選擇是分配和跟蹤發送到應用程序的通知的ID:

var receivedNotifications={}; 
push.on('notification', function(data) { 
    if(!receivedNotifications[id]){ 
     receivedNotifications[id]=true; 
     return; 
} 
     window.plugins.toast.showShortTop('You have received a new Application!'); 
     window.location.hash = 'home/contactus'; 
    });