2017-06-12 4 views
0

モードから​​にアプリを届けるようなイベントが発生した場合、アプリケーションを呼び出す方法はありますか? WhatsAppおよびSkype音声コールまたはビデオコールが到着したときにフォアグラウンドに持ち込まれます。Ionic 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(); 
} 

答えて

1

は、私の知る限りでは、あなたの唯一のオプションは、このプラグインである:http://ionicframework.com/docs/native/background-mode/

+0

私が更新されましたが、アプリがフォアグラウンド、時にはアプリがクラッシュするつもりはありません。クラッシュは 'this.backgroundMode.moveToForeground();'コードとは関係ありません。 – RSA

関連する問題