Howto move app from background to foreground?

Is there any method to move app from background to for ground when a push-notification arrive?

Not really, on mobile OS the users is king. If he decides your app should not be in background right now, that’s how it is,

You know, In my app services will inform to distributors by push notifications. if the app was close or in background or device is in standby mode only a single beep is not enough.

I think there should be a method. because how is possible when a video call is reciving by IM apps like whatsapp or skype the become to foreground and asking for user attention?

I just tested it for Whatsapp on iPhone:
For voice only calls this seems to be a special interface that is only for call type apps.
For video calls it is a simple push notification with a sound/vibration that repeats itself.

1 Like

I think this code should be work but it is not.


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

Is this actually executed while the app is in background? Normally notifications are only handed to the app when is or comes to the foreground. Same for video calls in Whatsapp by the way…

I found this method of firebase by my flawed intelligence. I tried to find other way for arrive event or any other method but nothing find…

@Sujan12 Do you have any idea about bringing app to foreground such as direct VoIp call instead of receiving push notification?

As I said, the “phone call” stuff is the only thing I ever saw on iOS that does something like that. If there were other ways, people would abuse it. And people would hate it. I certainly would - phone calls are really the only thing I want to “jump” in front of me.