0
當事件發生像通知到達時,是否有任何可能的方式將應用程序從background
模式帶入?如WhatsApp和Skype,當語音通話或視頻通話到達時,它將進入前臺。如何在離子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();
}
我已經更新,但該應用程序不會前景和應用程序有時會崩潰。崩潰與'this.backgroundMode.moveToForeground();'代碼無關。 – RSA