OneSignal Push Notification Background


#1

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();

#2

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


#3

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


#4

Yes this is possible.


#5

Hi Sujan12

Can you show me any example?

Thanks!


#6

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.


#7

I´m load app in device through command

ionic run android

Is necessary load one more command?


#8

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