2017-06-12 88 views
0

當事件發生像通知到達時,是否有任何可能的方式將應用程序從background模式帶入​​?如WhatsAppSkype,當語音通話或視頻通話到達時,它將進入前臺。如何在離子2中將應用程序從背景應用到前景?

更新:

public subscribeToPushNotificationEvents(): void { 

    // Handle token refresh 
    this.firebase.onTokenRefresh().subscribe(
     token => { 
     //console.log(`The new token is ${token}`); 
     this.saveToken(token); 
     }, 
     error => { 
     console.error('Error refreshing token', error); 
     }); 

    // Handle incoming notifications 
    this.firebase.onNotificationOpen().subscribe(
     (notification: NotificationModel) => { 

     this.backgroundMode.moveToForeground(); 

     let notificationAlert = this.alertCtrl.create({ 
      title: notification.title, 
      message: notification.body, 
      buttons: ['Ok'] 
     }); 
     notificationAlert.present(); 
} 

回答

相關問題