Ionic monitoring and sqlite doesn't work when app is closed

#1

I’m trying to save notifications that is recieved to the app when it’s closed to an sqlite db.
Everything works good when the app is open and even when it’s not in focus but when i close the app it stops to send logs to Ionic Pro Monitoring and it also stops to save notifications to the db.
Seems like there is something that i have missed to include.

Here is my app.component.ts

export class MyApp {
  @ViewChild(Nav) nav: Nav;
  rootPage: any;
  constructor(public app: App, public platform: Platform, public notificationService: NotificationService, public statusBar: StatusBar, public splashScreen: SplashScreen, public authenticationService: AuthenticationService, private oneSignal: OneSignal, private tokenService: TokenService) {
    Pro.monitoring.log("app.component.ts constructor", { level: "info" });
    this.platform.ready().then(() => {
      if (!this.authenticationService.isLoggedIn()) {
        var refreshTokenObservable = this.tokenService.refreshAuthentication({ force: true });
        refreshTokenObservable.subscribe(() => {
          if (!this.authenticationService.isLoggedIn()) {
            this.nav.setRoot(LoginComponent);
          }else{
            this.nav.setRoot(TabsPage, {
              selectedTabIndex:0
            });
          }
        });
      
      } else {
        this.nav.setRoot(TabsPage, {
          selectedTabIndex:0
        });
      }
      this.statusBar.backgroundColorByHexString('#f8f8f8');      
      this.statusBar.overlaysWebView(false);
      this.statusBar.styleDefault();
      this.statusBar.show();            

      this.splashScreen.hide(); 

      if (isCordovaAvailable()) {
        this.oneSignal.startInit(ENV.oneSignalAppId, ENV.firebaseSenderID);
        this.oneSignal.setSubscription(true);
        this.oneSignal.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.Notification);
        this.oneSignal.handleNotificationReceived().subscribe(data => this.onPushReceived(data.payload));
        this.oneSignal.handleNotificationOpened().subscribe(data => this.onPushOpened(data.notification.payload));
        this.oneSignal.endInit();
      }
    }).catch((err) =>{
      Pro.monitoring.exception(new Error(JSON.stringify("Failed to load initial platform" + err)))
    });
  }

  private onPushReceived(payload: OSNotificationPayload) {
    Pro.monitoring.log("On push recieved!" + JSON.stringify(payload.additionalData.accountItemId), { level: "info"})
    this.notificationService.increaseNotificationBadge(payload.additionalData.accountItemId);   
  }

  private onPushOpened(payload: OSNotificationPayload) {
    if (this.authenticationService.isLoggedIn()) {
      this.nav.setRoot(TabsPage, {
        selectedTabIndex: 0,
        searchProfileId: payload.additionalData.searchProfileId
      });
    } else {
      this.nav.setRoot(LoginComponent, {
        searchProfileId: payload.additionalData.searchProfileId
      });
    }
  }
}

I don’t know if onPushReceived is recieved since i can’t log it.
But it works when the app is opened or in focus.