Alerting From a background app

I want to show an alert or a dialog when I receive some data using oneSignal push notification and use its data to create mentioned alert/dialog.

public notifReceiver(jsonData) {
    alert(`Notif Received ` + JSON.stringify(jsonData));
    this.dialogs.alert('Hello world')
  .then(() => console.log('Dialog dismissed'))
  .catch(e => console.log('Error displaying dialog', e));
  console.log('Received');
  this.backgroundMode.moveToForeground();
  var additionalData = jsonData.additionalData;
  alert('Notif Received');
    
    switch (additionalData.type) {
      case "app":
        break;
      case "sms":

        break;

    }
  }

this is the code I’m using but it doesn’t bring app to foreground or even show any alert.