Show push notification inside the app

I integrated OneSignal platform in my application. I successfully receive the push notifications but I’d like to show the notifies the the same layout for external and internal notifies of the app.

When I’m in the app and I receve the notify, The simple alert has been showed (similar to javascript alert).
When I’m out of the app and I receive the notify, the classic notify appears.

How can I integrate the same layout inside the app? Could you please support me?

console.log("Cordova is available. PUSH Enabler has bean enabled");

      var notificationReceidedCallback = function (jsonData) {
        console.log(jsonData);
        console.log('notificationReceidedCallback: ' + JSON.stringify(jsonData));
      };

      var notificationOpenedCallback = function (jsonData) {
        console.log(jsonData);
        console.log('notificationOpenedCallback: ' + JSON.stringify(jsonData));
      };

      window["plugins"].OneSignal
        .startInit(FIREBASE_APP_ID, FIREBASE_SENDER_ID)
        .handleNotificationOpened(notificationOpenedCallback)
        .handleNotificationReceived(notificationReceidedCallback)
        .endInit();

Thanks
Luca

Hi,
Please use of this coding may it will working properly,

  this.oneSignal.startInit('Enter your one-signal id', 'ANDROID_ID');

  this.oneSignal.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.InAppAlert);

  this.oneSignal.handleNotificationReceived().subscribe(() => {
    // do something when notification is received
  }); 

  this.oneSignal.handleNotificationOpened().subscribe(() => {
    // do something when a notification is opened
  });

  this.oneSignal.endInit();

Thank you!

1 Like

So, I need to add this line?

Just a question for you. It seems that InAppAlert is a default value.
Official documentation link

Notification - native notification display while user has app in focus (can be distracting).
InAppAlert (DEFAULT) - native alert dialog display, which can be helpful during development.
None - notification is silent.

I’ll tryand I’ll provide a feedback

Thanks

I triestini to set “Notification” but the push is hidden when the app is opened

Could you please support me?