OneSignal Push Notification Background

Hi,

I trying receive pushnotifications when my app is close. It is Possible?

Thanks

 this._OneSignal.startInit("xxx", "xxxx");
      this._OneSignal.inFocusDisplaying(this._OneSignal.OSInFocusDisplayOption.None);
      this._OneSignal.setSubscription(true);      
      this._OneSignal.inFocusDisplaying(window["plugins"].OneSignal.OSInFocusDisplayOption.Notification);

      this._OneSignal.handleNotificationReceived().subscribe((data) => {
        // if (data.payload.additionalData)
        // {
           alert("Receveid");
        // }
      });

      this._OneSignal.handleNotificationOpened().subscribe((dataOpen) => {        

        let dadosDetail = this.schedlueProvider.GetSchedlueByID(30).subscribe(
          data => {                      
          }
        );        
      });
            
      this._OneSignal.endInit();

Your app should be able to receive notifications if it is in the background, but what it can’t do is take action on them until the user opens the app by clicking on the notification.

Can you clarify further what is happening and what you’re trying. The code sample helps, but we also need to know what your goal is and what your current behavior is

I need receive notification when my app is closed.
-User 1 save register
-User 2 need receive notification of User 1(App not need is running)

*My App is able to receive in background

Yes this is possible.

Hi Sujan12

Can you show me any example?

Thanks!

Every app that uses push notifications does this. Close the app, push to the app, the push notification is received by the OS and shown in the notification center. Done.

I´m load app in device through command

ionic run android

Is necessary load one more command?

If I closed the app and send notification, don’t show. Needed open the app

I got this issue also, do you have idea how to fix it?