'How to call back on the foreground a background application

I have an ionic cordova application that sends local notifications. I want either the local notification or a background task to trigger the app to go foreground (probably using @ionic-native/background-mode/ngx with .moveToForeground()). Something whatsapp and skype do when a call is received.
Currently nothing happend when i call the function .moveToForeground() inside the loop of local notifications.

Any directions about how to proceed would be greatly appreciated.
Thank you

import { Component } from '@angular/core';
import { Platform } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { NavigationExtras } from '@angular/router';
import { StorageService, Item } from './services/storage.service';
import { AuthenticationService } from './services/Authentication.service';
import { LocalNotifications } from '@ionic-native/local-notifications/ngx';
import {BackgroundMode} from "@ionic-native/background-mode/ngx";

@Component({
  selector: 'app-root',
  templateUrl: 'app.component.html'
})
export class AppComponent {

  constructor(
    private platform: Platform,
    private splashScreen: SplashScreen,
    private statusBar: StatusBar,
    private storageService: StorageService,
    private authenticationService: AuthenticationService,
    private localNotifications: LocalNotifications,
    private backgroundMode: BackgroundMode
  ) {
    this.initializeApp();
    this.backgroundMode.enable();

    setInterval(() =>{
      this.groupNotif()
        }, 19000);
  }

  groupNotif() {
    this.localNotifications.schedule([
      { id: 0, title: 'Design team meeting' },
      { id: 1, summary: '[email protected]', group: 'email', groupSummary: true },
      { id: 2, title: 'Please take all my money', group: 'email' },
      { id: 3, title: 'A question regarding this plugin', group: 'email' },
      { id: 4, title: 'Wellcome back home', group: 'email' }
    ]);
    this.backgroundMode.unlock();
    this.backgroundMode.moveToForeground();

  }


Solution 1:[1]

Moving an app from background to the foreground without user interaction on just receiving a push notification is NOT possible.

Tapping on the notification will bring your app from background/killed state to foreground.

Bringing an app from background/killed state to the foreground on receiving a call is a special case. Apple allows VoIP notifications to do that using PushKit and CallKit.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1