Howto move app from background to foreground?


#1

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


#2

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,


#3

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.


#4

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?


#5

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.


#6

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

#7

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…


#8

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…


#9

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


#10

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.